jInvertScroll icon indicating copy to clipboard operation
jInvertScroll copied to clipboard

Callback Function on init

Open JoshuaDoshua opened this issue 11 years ago • 2 comments

Is there a callback available once it has been initialized?

JoshuaDoshua avatar Oct 08 '14 12:10 JoshuaDoshua

There is the 'onscroll' option avaiable which can serve your purpose. It's mentioned on the plugin website. Is this what you were looking for?

$.jInvertScroll(['.myScrollableElements'], {
width: 'auto',  // Page width (auto or int value)
height: 'auto', // Page height (the shorter, the faster the scroll)
onScroll: function(percent)
{
 if(percent > 0.2 && percent <0.5)
{$("body").css("backgroundColor","black")}
else{$("body").css("backgroundColor","blue")}
        }
}
});

sakshamsaxena avatar Nov 06 '14 06:11 sakshamsaxena

Hi, at the moment there is no specific callback when it is initialized, but you can, as sakshamsaxena said, use the onscroll callback, wich is called everytime when the user scrolls up or down. If you want to run a specific code only one time (at the beginning), you can use a flag to do that, such as:

var flag = true;

$.jInvertScroll(....., onScroll: function(perc) { if(flag == true) { // do whatever you want flag = false; } });

If you need further assistance, do not hesitate to ask! ;-)

pixxelfactory avatar Nov 10 '14 08:11 pixxelfactory