JS Mouse Scrolling plugin Scrollpath: In this plug-in first to be inductive js is jquery, because the following JS are based on it. Furthermore, you need to introduce jquery.scrollpath.js, SCROLLPATH.CSS and your own JS and CSS.
Prefixfree.min.js and Jquery.easing.js can choose their own according to the actual situation.
First, write the HTML, and place each block in an absolute positioning block separately.
Then start using JS to draw the path according to location.
Define the path:
$.fn.scrollpath ("GetPath")
. moveTo (x, y, {name: "Start"})//x, Y can be understood to define the x-axis, the starting point of the y-axis
. lineTo (0, +, {name: "D1"})//Move line, right down to positive, negative, downward line to the point named D1
. LineTo (800, 800, {
Callback:function () {
Alert ("You can define a callback function after reaching a point")
},name: "D2"}
)
with x = 200,y = 200 as the center, the radius is 400, the arc is drawn, the horizontal right is 0 degrees, the Math.PI is 180 degrees,-math.pi/4 means clockwise rotation 90 degrees
. Rotate (2*math.pi, {
Name: "Rotations-rotated"
})
. Arc (0, 0,-math.pi, True, {name: "D4"});
Add path
$ (". Wrapper"). Scrollpath ({drawpath:true, wraparound:true});
Show path
$ (". Sp-canvas"). Show ()
To draw a path, you can define the speed:
$.fn.scrollpath ("ScrollTo", Target, +, "easeinoutsine");
The path effect of the drawing is this http://demo.qpdiy.com/hxw/scrollpath-master/hxw.html
A slightly more complex path can be seen http://www.jiawin.com/jquery-scroll-path/