I am trying to implement an infinite scroll in JS, I am using $(window).scroll() to detect the scroll position, every thing is working fine, I just have one issue I want the url to change if the user clicks the 'Home' key and then change again if the user press the 'End' key.
So when Home is clicked the scroll position will be move to the top and when End is clicked the scroll position will be moved to the bottom.
My Question is, how do you detect these behaviors (pressing Home/End)?
Youssef
KeyCode is 35 for END 36 for HOME!
function myKeyPress(e){
var keynum;
if(window.event){ // IE
keynum = e.keyCode;
}else
if(e.which){ // Netscape/Firefox/Opera
keynum = e.which;
}
alert(String.fromCharCode(keynum));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With