Page Redirect when Scrolling

0

Good afternoon, I need some code that allows the immediate redirection to another page when giving Scroll (at least Scroll that is made, at the very least movement). Someone can give me a tip, I'm still a beginner. Thank you all!

    
asked by anonymous 26.11.2017 / 20:11

2 answers

0

You can do this simply with JavaScript:

<script>
window.onscroll = function(){  
   location.href = "outra_pagina.html";
}
</script>
    
27.11.2017 / 01:16
0

For me this is not a good practice because scrollbars are areas on the side of the browser window, which indicate the existence of content that goes beyond the visible area of the page and allows the scrolling of the window to reach it, helping to adapt the window to published content.

JQUERY

  

In order to be as fast as possible, it is better to do it right on the click, because anyone who goes to Scroll will always want to roll!

var clickedOnScrollbar = function(mouseX){
  if( $(window).outerWidth() <= mouseX ){
    return true;
  }
}

$(document).mousedown(function(e){
  if( clickedOnScrollbar(e.clientX) ){
    window.location = "https://pt.stackoverflow.com/";
  }
});
#a {
height:1200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="a"></div>
    
27.11.2017 / 01:11