最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Redirect after scrolling the page

programmeradmin2浏览0评论

is it possible to create a redirect only after the page has been scrooled, for example, in the middle and redirects to another page? I tried various solutions and plugins but couldn't find anything that suited me

is it possible to create a redirect only after the page has been scrooled, for example, in the middle and redirects to another page? I tried various solutions and plugins but couldn't find anything that suited me

Share Improve this question asked Mar 1, 2022 at 21:18 Meliodas861Meliodas861 1 1
  • Also this is not good for user experience or accessibility to randomly redirect a user as their scrolling, it will confuse screen readers. – wpDev Commented Mar 7, 2022 at 15:47
Add a comment  | 

1 Answer 1

Reset to default 0

Try this solution: You can easily do this by using jQuery.

jQuery(document).scroll(function() {
  var y = $(this).scrollTop();
  if (y > 800) {
    window.location.replace("http://stackoverflow.com");
  } else {
    console.log('test');
  }
});

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论