JS Mouse Scroll Plugin scrollpath use introduction

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.