I make navigation with pages but this code not work, what's the problem ?
<script>
$(document).ready(function() {
$("body").keydown(function(event) {
if(event.keyCode == 37) { // left
window.location.replace("http://newsii.abudayah.com/photo/2)"; }
else if(event.keyCode == 39) { // right
window.location.replace("http://newsii.abudayah.com/photo/31)"; }
});
});
</script>
The replace() method of the Location interface replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History , meaning the user won't be able to use the back button to navigate to it.
Window location. The replace() method replaces the current document with a new one.
Don't use .replace()
for this, just assign the value directly.
Example
$("body").keydown(function(event) {
if(event.keyCode == 37) { // left
window.location = "http://newsii.abudayah.com/photo/2";
}
else if(event.keyCode == 39) { // right
window.location = "http://newsii.abudayah.com/photo/31";
}
});
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