September 7, 201214 yr Hello everyone, I need to create an accordion on my websites homepage. I have looked around at plugins and open source scripts and there do seem to be quite a few options but all have slight issues with regards to what I'd like to achieve. Here is a link to what I need to create. http://www.jackod.com/ofato_blog/Picture%2011.png Does anyone know of anyone good ways to achieve this or have any links to decent plugins? Thanks so much in advance. Regards Jack
September 7, 201214 yr I have done this before, give me an hour or so i will post it up here for you, if no one can help before
September 7, 201214 yr Here You Go, you need to change the CSS to make it work how tou want, this is a plugin i found but cant find the link to give them any credit. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <style type="text/css"> #accordion { width: 600px; list-style: none; margin: 10px 0; padding: 0; height: 200px; overflow: hidden; background: #31AEE8; border: solid 1px #000000; } #accordion li { float: left; display: block; height: 170px; width: 50px; padding: 15px 0; overflow: hidden; color: #fff; text-decoration: none; font-size: 16px; line-height: 1.5em; border-left: 1px solid #000000; list-style-position: outside; } #accordion li img { border: none; border-right: 1px solid #000000; float: left; margin: -15px 15px 0 0; list-style-position: outside; } #accordion li.active { width: 371px; list-style-position: outside; } </style> <script type="text/javascript"> $(document).ready(function(){ activeItem = $("#accordion li:nth-child(3)"); $(activeItem).addClass('active'); $("#accordion li").hover(function(){ $(activeItem).animate({width: "50px"}, {duration:1000, queue:false}); $(this).animate({width: "371px"}, {duration:1000, queue:false}); activeItem = this; }); }); </script> <ul id="accordion"> <li> <img src="images/sample1.jpg" alt="sample1"/> <strong>Header 1</strong><br/> <p>Text links go here</p> </li> <li> <img src="images/sample2" alt="sample2" /> <strong>Header 2</strong><br/> <p>Text links go here</p> </li> <li> <img src="images/sample3.jpg" alt="sample3" /> <strong>Header 3</strong><br/> <p>Text links go here</p> </li> <li> <img src="images/sample4.jpg" alt="sample4" /> <strong>Header 4</strong><br/> <p>Text links go here</p> </li> <li> <img src="images/sample5.jpg" alt="sample4" /> <strong>Header 5</strong><br/> <p>Text links go here</p> </li> <li> <img src="images/sample6.jpg" alt="sample" /> <strong>Header 6</strong><br/> <p>Text links go here</p> </li> </ul>
Create an account or sign in to comment