i've designed an accordion gallery displaying different images - and it follows the structure of days of the week
What i am trying to achieve is for gallery to load the correct tab (day of the week) as soon as the user loads page. i.e today is wednesday - wednesday tab will be opened. At the moment the javascript i do have only loads the first img from the 'li' which happens to be Monday. I am very new to javascript - my skills are very limited with JS.
This is my HTML
<div class="contentDiv">
<ul id="DOTD">
<li>
<img src="images/1NewBC/DOTD/Monday.gif">
</li>
<li>
<img src="images/1NewBC/DOTD/Tuesday.gif">
</li>
<li>
<img src="images/1NewBC/DOTD/Wednesday.gif">
</li>
<li>
<img src="images/1NewBC/DOTD/Thursday.gif">
</li>
<li>
<img src="images/1NewBC/DOTD/Friday.gif">
</li>
<li>
<img src="images/1NewBC/DOTD/DOTW.gif">
</li>
<li>
Blank Blank
Blank Blank
Blank Blank
Blank Blank
Blank Blank
</li>
</ul>
</div>
Here is my JavaScript - really basic - all it does is loads first img fromt the list and created a click event so user can manualy click through the tabs
<script>
$(document).ready(function(){
activeItem = $("#DOTD li:first");
$(activeItem).addClass('active');
$("#DOTD li").click(function(){
$(activeItem).animate({width: "28px"}, {duration:300, queue:false});
$(this).animate({width: "741px"}, {duration:300, queue:false});
activeItem = this;
});
});
</script>
and this is my css for accordion gallery
/* Deal of the Day Coding */
/* DoTD Background */
#content .contentDiv #DOTD{
list-style: none;
overflow: hidden;
background: rgb(36,73,148);
display: inline-block;
margin-left: 0px;
margin-bottom: -10px;
}
/* DotD list and text color */
#DOTD li{
float: left;
border: 4px solid rgb(255,255,255);
display: block;
height: 120px;
width: 28px;
overflow: hidden;
color: white;
font-size: 16px;
line-height: 1.5em;
}
#DOTD li img{
border: none;
float: left;
}
#DOTD li:hover{
border: 4px ridge black;
}
#DOTD li.active{
width: 741px;
}
Any help would be much apreccieated!! I am so new to JavaScript that i dont even know where to start