javascript - click button on url change (with scrolling) -


i novice in web coding , had problem implementation of simple code.

$(window).on('hashchange', function(e, direction){     if (direction === 'up') {         $(".prev").click();     }        else {         $(".next").click();     } }); 

so, when user scrolling down , url changing - click button .next (this part work fine). when scrolling @ top&url changing -> click .prev (it not work).

and have 1 question. code work fine without hashtag in url? (mysite.com/?p=1 example).

so html part just:

<div id="p1" class="width:100%; height:500px;"></div> <div id="p2" class="width:100%; height:500px;"></div> <div class="next"></div> <div class="prev"></div> 

and there 1 js code, change url when user scroll top/down of div's. don't know how detect scrolling bottom top... ur time!


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -