I'm using the Jquery Cycle plugin for a slideshow, and I want to add an event when a certain slide is active. The Cycle plugin achieves this by adding and removing the opacity of the images in a certain div like so:
<div style="position: absolute; top: 0px; z-index: 9; display: none; opacity: 0;">
When the image is active, or is the current slide, the opacity changes to 1, and the display to "block".
Now I've tried using different approaches, from detecting the css style/attribute of the div to assigning a class to said div, and then do something:
if($("#slideshow > div:nth-child(2)").hasClass('fadeOut') == 1) {
alert('Hello');
}
or
if($("#slideshow > div:nth-child(2)").css('opacity') == 1) {
alert('Hello');
}
and even
if($(".fadeOut").css('opacity') == 1) {
alert('Hello');
}
The problem is that the JS doesn't detect the "opacity: 1" style when it's applied dynamically with the Cycle plugin. On the other hand it does work when the style is applied inline in the css file, and of course, that does not work, because the event fires the minute the page is loaded, when what I want is for the event to fire when and only when the 2nd image is the active one, in other words, when it has either "opacity" set to 1 or "display" to block, and can't seem to figure it out.