Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback Function on init #17

Open
JoshuaDoshua opened this issue Oct 8, 2014 · 2 comments
Open

Callback Function on init #17

JoshuaDoshua opened this issue Oct 8, 2014 · 2 comments

Comments

@JoshuaDoshua
Copy link

Is there a callback available once it has been initialized?

@JoshuaDoshua JoshuaDoshua changed the title Callback? Callback Function on init Oct 8, 2014
@sakshamsaxena
Copy link

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")}
        }
}
});

@pixxelfactory
Copy link
Owner

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! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants