Nothing Displays 5 or below

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Mon Oct 15, 2012 6:08 pm
Reply with quote
Report this post
I'm having an issue and I was trying to find what could fix it.

Problem:
We have only 5 speakers to display and if there are only 5 then nothing displays on the front GK News Show Pro. If we have 6 or more displayed then it will show, but we only need 5. So when we only have our 5 published the circles are blank.

thank you
User avatar
Fresh Boarder

GK User
Tue Oct 16, 2012 7:34 am
Reply with quote
Report this post
User avatar
Administrator

GK User
Tue Oct 16, 2012 9:42 pm
Reply with quote
Report this post
Thank you, that solved the display issue, but is there anyway to still let it rotate between the 5 different people putting one in the middle? So basically keeping the animation still
User avatar
Fresh Boarder

GK User
Wed Oct 17, 2012 8:03 am
Reply with quote
Report this post
It will need probably the bigger changes in the code, I'll prepare it when we will release the Fest Theme for WP (so probably tommorow).
User avatar
Administrator

GK User
Fri Oct 19, 2012 10:51 am
Reply with quote
Report this post
Ok, I've fixed the code to work with the 5 persons properly:

Code: Select all
window.addEvent("load", function(){   
    $$('.nspMainPortalMode6').each(function(module){
      new GKNSPSpeakers(module);
   });
});

var GKNSPSpeakers = new Class({
   id: '',
   $G: null,
   current_offset: 0,
   anim_interval: 0,
   current: 0,
   total: 0,
   items: [],
   availableItems: null,
   hover: false,
   
   initialize: function(module) {
      this.id = module.getProperty('id');
      this.$G = $Gavick[this.id];
      this.current_offset = 0;
      this.anim_interval = this.$G['animation_interval'];
      this.current = 4;
      this.total = module.getElements('.nspRestSpeakers .nspSpeaker').length;
      
      // if there is more than 5 slides
      if(this.total >= 5) {
         // prepare handlers
         this.items[0] = module.getElement('.nspSpeakers .nspSpeakersSmallLeft .nspSpeakerSmall');
         this.items[1] = module.getElement('.nspSpeakers .nspSpeakersSmallLeft').getElements('.nspSpeakerSmall')[1];
         this.items[2] = module.getElement('.nspSpeakers .nspSpeakerBig');
         this.items[3] = module.getElement('.nspSpeakers .nspSpeakersSmallRight .nspSpeakerSmall');
         this.items[4] = module.getElement('.nspSpeakers .nspSpeakersSmallRight').getElements('.nspSpeakerSmall')[1];
         //
         this.availableItems = module.getElements('.nspRestSpeakers .nspSpeaker');
         //
         var $this = this;
         //
         this.items.each(function(el, i) {
            el.removeClass('speakerHide');
         });
         // run the animation
         setTimeout(function() {
            $this.gkChangeSpeakers();      
         }, this.anim_interval + 400);
         
         this.items.each(function(el, i) {
            el.addEvent('mouseenter', function() {
               $this.hover = true;
            });
            
            el.addEvent('mouseleave', function() {
               $this.hover = false;
            });
         });
      }
   },

   gkChangeSpeakers: function() {
      //
      var $this = this;
      //
      if(!this.hover) {
         // hide speakers
         this.items.each(function(el, i) {
            el.addClass('speakerHide');
         });
         
         if(this.current < this.total - 1) {
            this.current += 1;
         } else {
            this.current = 0;
         }
         
         setTimeout(function() {
            var IDs = [0, 0, 0, 0, 0];
            
            IDs[4] = $this.current;
            totalOffset = $this.total;
            
            IDs[3] = ($this.current - 1 < 0) ? --totalOffset : $this.current - 1;
            IDs[2] = ($this.current - 2 < 0) ? --totalOffset : $this.current - 2;
            IDs[1] = ($this.current - 3 < 0) ? --totalOffset : $this.current - 3;
            IDs[0] = ($this.current - 4 < 0) ? --totalOffset : $this.current - 4;
            
            $this.items[0].innerHTML = $this.availableItems[IDs[0]].innerHTML;
            $this.items[1].innerHTML = $this.availableItems[IDs[1]].innerHTML;
            $this.items[2].innerHTML = $this.availableItems[IDs[2]].innerHTML;
            $this.items[3].innerHTML = $this.availableItems[IDs[3]].innerHTML;
            $this.items[4].innerHTML = $this.availableItems[IDs[4]].innerHTML;
         }, 600);
         
         // show speakers
         setTimeout(function() {
            $this.items.each(function(el, i) {
               el.removeClass('speakerHide');
            });
         }, 750);
      }
      //
      setTimeout(function() {
         $this.gkChangeSpeakers();      
      }, this.anim_interval + 800);
   }
});


please put this code in the modules/mod_news_pro_gk4/interface/scripts/engine.portal.mode.6.js
User avatar
Administrator

GK User
Wed Nov 28, 2012 3:15 pm
Reply with quote
Report this post
Thanks for providing this solution, but are there plans to automate this so one doesn't have to keep changing the code every time there is a change in the number of speakers? For example, if one decide to have only 4 speakers the new/updated code does not work.
User avatar
Fresh Boarder

GK User
Tue Aug 26, 2014 7:46 am
Reply with quote
Report this post
If this module is any indication of what Gavick offers across the platform, I can't see how anyone actually uses this stuff? This is terrible to have this many problems and oversights.

It has 5 open slots on the homepage, but if you only have 5 articles in it, it breaks the entire thing? What a joke. This is my first experience with Gavick after using paid templates/extensions from many other companies. It'll no doubt be my last after fighting this module and seeing such a mickey-mouse solution as the only plausible fix.
User avatar
Fresh Boarder


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.