The knowledge point record used by jquery to change the status title when scrolling a page to a screen

Source: Internet
Author: User

Trigger event when browser scroll bar scrolls

    // Trigger event    when browser scroll bar scrolls $ (window). Scroll (function() {});

Trigger event when browser window size changes

    // Trigger event    when browser window size changes $ (window). Resize (function() {});

Listen to all anchor links for smooth movement.

    //Listen to all anchor links for smooth movement.$ (' a[href*=#],area[href*=#] '). Click (function() {        if(Location.pathname.replace (/^\//, ") = = This. Pathname.replace (/^\//, ') && location.hostname = = This. Hostname) {            var$target = $ ( This. hash); $target= $target. Length && $target | | $ (' [name= ' + This. Hash.slice (1) + '] '); if($target. Length) {varTargetoffset =$target. Offset (). Top; //to improve the user experience, make algorithmic improvements to start                varClientHeight = Document.body.clientHeight;//Browser Visual HeightTargetoffset = targetoffset-(CLIENTHEIGHT/2) +100;//End$ (' html,body '). Stop (true). Animate ({Scrolltop:targetoffset},1000); return false; }        }    });

Gets an element based on the distance from the bottom of the current browser window

// gets an element based on the distance from the bottom of the current browser window function Get_element_window_bottom (choose) {    ifreturnfalse;     = $ (choose) [0].offsettop;     = $ (window). scrolltop ();     = Mtop- sTop;     // add an algorithm to improve user experience    Result    =    result+parseint (DOCUMENT.BODY.CLIENTHEIGHT/2);    return      result;}

Effect example diagram

The knowledge point record used by jquery to change the status title when scrolling a page to a screen

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.