PDA

View Full Version : SAG Scroller - Suggestion



zgmex
01-17-2013, 07:06 PM
SAG Scroller is great! I use it to scrolls ads.
Suggestion: It will be great if "random" option could be added to it so first image (ad) will change on every page load.
Thank you.
Regards.

jscheuer1
01-17-2013, 08:15 PM
Random means random, so it's possible you will get the same order and/or similar order twice or even more in a row. The more images or whatever you have, the less likely you will get repetitions, but it can still happen.

That said, in the head of the page, add this (highlighted) before the new sagscroller() command as shown:


//SAG scroller demo #1:
jQuery(function($){
var contents = [], i, $parent = $('#mysagscroller ul:eq(0) >li').each(function(){
contents.push(this);
}).parent();
contents.sort(function(){return 0.5 - Math.random();});
i = contents.length;
while (--i > -1) {
$parent.append(contents[i]);
}
});

var sagscroller1=new sagscroller({
id:'mysagscroller',
mode: 'manual' //<--no comma following last option
})

Just make sure that the id in the new sagscroller() command is the same as that in the preceding code (red in both above).

The browser cache may need to be cleared and/or the page refreshed to see changes.

Here's a demo:

http://home.comcast.net/~jscheuer1/side/sagscroller/demo.htm

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

zgmex
01-18-2013, 04:57 AM
Thank you very much!!! Works like a charm.