anon
Posts: 0
Joined: Sun Apr 13, 2014 12:10 am

Unique page selector jQuery

I am trying to execute a piece of jQuery on a particular page in Appery. It is a little bit of logic to toggle the visibility of the footer depending on which way the user scrolls (like facebook's filtering footer navbar)

However, the logic is working on other pages than specified in the load event. (I only want this to work on the page I defined it in on Load).

How do I fix this?

Code:

$(window).on({
scrollstop: function() {
var st = $(this).scrollTop();
if (st = windowHeight){
Appery('mobilefooter').hide();
} else {
Appery('mobilefooter').show();
}
windowHeight = st;
cache.windowHeight = st;
}
});

Is there a way to target the specific window? $(this)?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Unique page selector jQuery

Hi,

'window' is a browser window variable that can't be defined for a specific page. You can add a check to this handler to see whether the page is active:preif( Apperyio("screenName").is(':visible')){
alert("visible");
}/pre

anon
Posts: 0
Joined: Sun Apr 13, 2014 12:10 am

Unique page selector jQuery

$(window).on({
if( Apperyio("screenName").is(':visible')){
scrollstop: function() {
var st = $(this).scrollTop();
if (st = windowHeight){
Appery('mobilefooter').hide();
} else {
Appery('mobilefooter').show();
}
windowHeight = st;
cache.windowHeight = st;
}
}
});

Did the trick thanks

Return to “Issues”