jQuery(document).click(function () {
jQuery('.close-news').css('display', function(){return jQuery('#colorbox').css('display');});
});
I have this script, which make my link appear\\dissappear depends on state of #colorbox block. But somewhy link appear\\dissappear not immediatelly, but after 2 click. Basically i have to click one more time in random area to make my script work I guess its because my html code isnt update fast enought to make . So how do i add some timeout for this script?
It seems you are using Colorbox in Drupal.
There can be a callback function that gets executed once the Colorbox is shown up.
After Debugging your site, seems that there is a cbox_complete
custom event firing up.
If thats the case, you can attach a function to this event.
In the function, you can toggle the display of your .close-news
li
element, similar to what you are doing on document click in the question
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.