jquery event binding on () and Bullet window implementation code _jquery

Source: Internet
Author: User

The page will often have a window, and some of the window is dynamically generated, and some of the window is hidden at the bottom of the page, for dynamically generated window, if you want to listen to the events of the window, you can use jquery event binding on () method implementation.

As shown in the picture, the window is JS dynamic generation, by clicking on a link popup, pop-up window in the "immediately to use" link clicked, the effect is to close the window, and jump to the anchor point.

This a label is:

Copy Code code as follows:

<a style= "Display: title=" immediately to use "target=" _blank "gid=" 167 "href=" http://act.vip.***.com/vip/2016/51dps/# Gamelist "class=" Co_vip TDU "> immediately to use </a>

We want to monitor the click event in the window, but the window itself is dynamically generated, so we have to listen to the body, through on () event binding, when dynamically generated this window, you can monitor the click Method:

function Jump_to_anchor () {
  $ ("body"). On ("click", "Span[name= ' Msgbox_info '] a,. act-pop-table a", function (e) {
    link = $ (this). attr (' href ');
    if (link = = ' http://act.vip.***.com/vip/2016/51dps/#gamelist ') {
      e.preventdefault ();
      Msgexit ();
      window.location.href = link;}}
  );

This is actually a binding of two-a-tag event bindings, both when the link is a URL, blocks the default behavior, and calls the close window method to jump to the link, which is the anchor point.

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.