Js implements index slide display and slide display of the address book

Source: Internet
Author: User
The following small series will bring you an article about the index slide Display Effect of the address book and the slide display anchpoint Effect of js. I think this is quite good. Now I will share it with you and give you a reference. Let's take a look at the following small series to bring you a js index sliding Display Effect of the address book and the sliding display anchor effect. I think this is quite good. Now I will share it with you and give you a reference. Let's take a look at it with xiaobian.

Only implement .. Performance optimization is not considered at all. So I implemented a special card later.

The first one is to slide the index bar on the right of the address book, and slide to the corresponding letter to jump to the corresponding letter's anchor.

Ideas:Listen to the touchmove event, obtain clientX and clientY, pass in to elementFromPoint, and then obtain the element and execute click.

There is a problem here, that is, if you have top-level elements such as the mask layer on your page, please set pointer-events: none, even if the display: none of this element is useless, practice. You can try it out.

Index is the id of index p.

$("#index").get(0).addEventListener('touchmove',function(event){   var a = document.elementFromPoint(event.touches[0].clientX,event.touches[0].clientY).parentNode;   a.click();  });

Second, I want to display this letter when the page slides to a letter.

Ideas:Listen to scroll events, and use elementFromPoint to obtain the corresponding elements of the desired location, and then execute the display effect.

Ps: weui is used

$(window).scroll(function(){  var a = document.elementFromPoint(0,0);  if($(a).hasClass("weui_cells_title"))  {   $(".weui_toast_content_my").html($(a).attr("name"));   $("#toast").show(0);   $("#toast").slideUp(300);  } });

Okay, it's over.

The above js achieves index slide display of the address book and slide display of the anchor effect is all the content that I have shared with you. I hope you can give me a reference and support PHP.

For more js implementations of index slide display effects of address book and slide display anchor effect, please pay attention to PHP Chinese network!

Related Articles:

Php implements the online address book function (with source code) and Address Book source code

Detailed description of the sample code used by the HTML5 address book to obtain the information of multiple specified individuals

Detailed description of code example for creating address book with XML data island and Dom

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.