I am basically checking if the <li> id has an "active" class so I can show the relevant div box.
I have 5 sliding images... each of these sliding images has their own div box with its own information in it.
I am placing this in a different section of the website otherwise I would have put this information with the image slider...
This is the javascript I am using to show and hide the div box depending on what image is on show on the slider:
Code:
function updateDiv(){
if ($('#slide1').hasClass('panel active')) {
document.getElementById('image1-info').style.display="block";
document.getElementById('image2-info').style.display="none";
document.getElementById('image3-info').style.display="none";
document.getElementById('image4-info').style.display="none";
document.getElementById('image5-info').style.display= "none";
if ($('#slide2').hasClass('panel active')) {
document.getElementById('image1-info').style.display="none";
document.getElementById('image2-info').style.display="block";
document.getElementById('image3-info').style.display="none";
document.getElementById('image4-info').style.display="none";
document.getElementById('image5-info').style.display="none";
...etc
}
The slider scrolls through the images automatically ... and you can navigate left to right. I have added the javascript function to these arrows like so:
This doesn't work well, as it seems to miss out the first click so the wrong div box appears.
When I use the function "onmouseover" the right box appears but you have to hover the arrows again and no one will do that. I need the right box to appear on click...
The image slider begins automatically as soon as you enter the page, so is there a way to check which <li> id and class it is on show/hide the right div box?....
Can anyone help?
Hope this all makes sense.
Many thanks
Last edited by Kor; 04-25-2012 at 04:39 AM.
Reason: needed JQuery prefix
wow thanks a lot for the code Padonak!!!
That has really helped!
It seems this line
Code:
$(document).ready(function(){updateDiv();});
is clashing with the slider somewhere not sure where!?! but the slider stops working... I'm going to have a look at the code properly now so I'll let you know how I get on!!...
1 remove function updateLi() from the script 2 remove the $(document).ready(function(){updateDiv();}); line also 3 in the linked script (jquery.slider.js) in the Options section (about the line 776) find the line
Code:
onSlideComplete : function(slider) {}, // Callback when slide completes - no event variable!
4 uncomment the line and change it this way:
Code:
onSlideComplete : function(slider) {updateDiv();}, // Callback when slide completes - no event variable!
it seems to work properly for me now
use [code]YOUR CODE GOES HERE[/code] or burn in Hell
Bookmarks