Hello everybody,
I found a strange behaviour on my slideshow. The slideshow itself actually works, including the captions that I put on top of the slideshow using css.
I now want to remove the captionbar when hovering a certain element. But it only works with the first picture.
I have put the code below and you can test it here
Any help or workaround is appreciated.
Thank you very much in advance.
HTML Code:<html> <head> <title></title> <meta content=""> <style> #slideshow { position:relative; } #slideshow DIV { position:absolute; top:0; left:0; z-index:8; opacity:0.6; background-color: #006600; } #slideshow DIV.active { z-index:10; opacity:1.0; } #slideshow DIV.last-active { z-index:9; } #slideshow DIV IMG { height: 566px; display: block; border: 0; } #captionbar { background-color: #006600; color: #FFFFFF; font-family: ProximaNlt,Verdana,sans; font-size: 40px; font-weight: normal; height: 80px; line-height: 80px; opacity: 0.6; padding-left: 30px; width: 950px; z-index: 5; } #hover { font-size: 18px; margin: 20px; background-color: yellow; } </style> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.min.js"></script> <script type="text/javascript" src="fadingslideshow.js"></script> <script type="text/javascript" src="fadetopbars.js"></script> </head> <body> <div id="hover">HOVER HERE</div> <div id="slideshow"> <div class="active"> <div id="captionbar">Caption for image 1</div> <img src="http://www.makems.com/graphic/beach-34.jpg" alt="Slideshow Image 1" /> </div> <div> <div id="captionbar">Caption for image 2</div> <img src="http://www.makems.com/graphic/beach-36.jpg" alt="Slideshow Image 2" /> </div> <div> <div id="captionbar">Caption for image 3</div> <img src="http://www.makems.com/graphic/beach-37.jpg" alt="Slideshow Image 3" /> </div> <div> <div id="captionbar">Caption for image 4</div> <img src="http://www.makems.com/graphic/beach-38.jpg" alt="Slideshow Image 4" /> </div> </div> </body> </html>Code:function slideSwitch() { var $active = $('#slideshow DIV.active'); if ( $active.length == 0 ) $active = $('#slideshow DIV:last'); // use this to pull the divs in the order they appear in the markup var $next = $active.next().length ? $active.next() : $('#slideshow DIV:first'); // uncomment below to pull the divs randomly // var $sibs = $active.siblings(); // var rndNum = Math.floor(Math.random() * $sibs.length ); // var $next = $( $sibs[ rndNum ] ); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); }); } $(function() { setInterval( "slideSwitch()", 3000 ); });Code:jQuery(function($){ $("#hover").hover(function() { $('#captionbar').animate({"opacity": "0"}, "fast"); }, function() { $('#captionbar').animate({"opacity": "0.6"}, "slow"); }); });




Reply With Quote


Bookmarks