Home >Web Front-end >JS Tutorial >JQuery realizes the mouse wheel sliding to the page node_jquery
The following is a detailed introduction to how the mouse wheel slides to the page node through a piece of JQuery code, and is shown to everyone through a display rendering.
Slide to the node part of the page based on jQuery mouse wheel. This is a special effect based on jQuery CSS3 that uses the mouse wheel or gestures to slide to part of the page node. The rendering is as follows:
Implementation code.
html code:
<section class="panel home" data-section-name="home"> <div class="inner"> <header> <h1></h1> <p class="tagline">适用浏览器:360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗.<br><br>不支持IE8及以下浏览器。<br><br><br></p> </header> <div style="text-algin:center;margin:10px auto"> <script src="/js/ad_js/bd_76090.js" type="text/javascript"></script></div><br /> <a href="#overview" class="scroll">滑动鼠标滚轮</a> </div> </section> <section class="panel overview" data-section-name="overview"> <div class="inner"> <h2>基本使用</h2> <p>需要引入 jQuery 1.6+ 以及缓冲动画插件jquery.easing.js.</p> <pre class="brush:php;toolbar:false"> <! doctype html> <html> <head> <script> $(function() { $.scrollify({ section : "section", }); }); </script> </head> <body> <section></section> <section></section> </body> </html>
$.scrollify({ section : "section", sectionName : "section-name", easing: "easeOutExpo", scrollSpeed: 1100, offset : 0, scrollbars: true, before:function() {}, after:function() {} });
滑动到指定的节点。
$.scrollify("move","#name");
js code:
$(function () { $(".panel").css({ "height": $(window).height() }); var timer; $(window).resize(function () { clearTimeout(timer); timer = setTimeout(function () { $(".panel").css({ "height": $(window).height() }); }, 40); }); $.scrollify({ section: ".panel" }); $(".scroll").click(function (e) { e.preventDefault(); $.scrollify("move", $(this).attr("href")); }); });
The above code is the entire content of using JQuery to realize the mouse wheel sliding to the page node. I hope it will be helpful to everyone in the future project process.