简体   繁体   中英

JQuery Cycle Plugin Not Working When Hidden Div Becomes Visible?

Using http://jsfiddle.net/Jk59f/

What do I do to get the cycle plugin working when 1 of these hidden div is visible?

edit: Updated JFiddle to show the exact problem. now you can see the slider anchors dont work at all.

I see the problem now. The issue is that you wipe out your slideshow with the following lines.

var contentTobeLoaded = $("#workitem" + id).html();
$('#ajax').html(contentTobeLoaded)

When you copy html you don't copy the event handlers associated with the elements. It looks like in the end you expect the images to be loaded via ajax. So what you will need to do is call the cycle plugin AFTER all the elements have been loaded via ajax. You can't just call it at the beginning of your scripts and expect it to work with newly loaded elements.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM