-1

Site: http://bit.ly/1dPAXsS

The above webpage opens a popup when the "Inform me when available" button is clicked. Using the current HTML I believe clicking the class "open" triggers the popup:

<a href="#" class="open cc-inform"><img src="http://uat.priworks.com/SustainGreen/sites/all/themes/sustaingreen/images/cc-applynow.png"></a>

My question is, can I formulate a URL that when loaded automatically triggers the popup to open. It should NOT open anytime the page is loaded but only when coming from a page using a specific url with the trigger. ie.e www.site.com/page#open or something - Pretty sure I can do this with js/jquery but not sure if I will need to change the way the popup is currently.

4

1 回答 1

1

抱歉,Kevin,但您似乎没有正确理解 DOM 概念。“open”类可能用于选择元素并为其分配点击事件,但它不会触发弹出窗口。你肯定可以做你需要的,而且很容易。

网址:

www.site.com/page#open 

查询:

$(function(){
  if(location.hash == '#open'){
    $('.popbox .open').click()
  }
});
于 2013-09-04T17:00:13.923 回答