Executes two times for the jquery binding click event, the layer popup, and the IMG's Map attribute application.

Source: Internet
Author: User

Shortly before using jquery and layer to implement a pop-up box, found in the binding popup event, the event executed two times, accurate is the method at the same time registered two times, not in succession performed two times, resulting in pop-up box two times. Consult colleagues, found that the reason may be jquery js and layer of JS conflict (specific reasons need to understand), through the network and ask colleagues, got three kinds of processing methods.

Method One: Add the onclick event directly to the tag without using jquery to bind the event.

Method Two: Use this way $ ("#item_add_button") [0].onclick = function () {method body}. The specific reason for further study.

Method Three: Before binding the event, Add. Unbind ("click") to clear the Click event before binding the Click event $ (". Item_add_button"). Unbind ("click"). Click (function () {method body }

Use the Layer pop-up box to select the appropriate type as needed. Refer to the documentation for details: http://sentsin.com/jquery/layer/

The project uses a different part of the picture (usually in the map) to link the content. The Usemap property of is used. Reference http://www.w3school.com.cn/tags/att_img_usemap.asp

Example: usemap="#planetmap" />

Name= "planetmap" >  <area href= "sun.htm" shape= "rect" coords= "0,0,110,260" >Sun</a>  <area href= "mercur.htm" shape= "Circle" coords= "129,161,10" >Mercury</a>  <area href= "venus.htm" Shape= "Circle" coords= "180,139,14" >Venus</a></map>

Where the Shape property can be polygon, making the shape a polygon. After the coords coords= "X1,y1,x2,y2,x3,y3,...": Each pair of "x, y" coordinates define a vertex of the polygon ("0,0" is the coordinate of the upper-left corner of the image).
Defining a triangle requires at least three sets of coordinates, while high-latitude polygons require a larger number of vertices. Polygons are automatically closed, so you don't need to repeat the first coordinate to close the entire area at the end of the list. Then add the appropriate link in the href.

Executes two times for the jquery binding click event, the layer popup, and the IMG's Map attribute application.

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.