开发者

jQuery queue and trigger

开发者 https://www.devze.com 2023-02-06 05:32 出处:网络
I have a dynamic page and am trying to build dynamic links (domain.com/#/page2/content/etc). If the person enters a link, let\'s say domain.com/#/2010/05/14 I want it to click on the element #2010.$(

I have a dynamic page and am trying to build dynamic links (domain.com/#/page2/content/etc).

If the person enters a link, let's say domain.com/#/2010/05/14 I want it to click on the element #2010. $("#2010").trigger("click");

Then after the function loads, click on $("#05").trigger("click");

See what I'm saying? As of right now it works per开发者_JS百科fectly for the first one, but the second click runs before the other can load.


You will need to build a function that runs at the end of the click function of $('#2010') that checks if there is another link to click. You could build an array of components at page load and at the end of each click function check if there are any more parts of the array, if there are trigger the next click. Each time you go through remove the element from the array so that it won't be used again.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号