Can it get smaller?
Can it get smaller?
Ok,
Can it get any smaller / more logical?
I created this (with help from internet/ and info from here). It works that's just great. HOWEVER the coding is in my opinion incredible dirty so to say.
Could you get this code more efficient / better?
Copy code
- $jquery('ul.show_pictures li').filter(':not(:first)').hide().end().filter(':first').addClass('showing');
- $jquery('ul.show_menu li').filter(':first').addClass('showing_menuitem');
- rotate = function(){
- $jquery('ul.show_menu li').removeClass('showing_menuitem');
- $activeM.addClass('showing_menuitem');
- $jquery('ul.show_pictures li').removeClass('showing').fadeOut();
- $active.addClass('showing').fadeIn();
- };
- rotateSwitch = function(){
- play = setInterval(function() {
- $active = $jquery('ul.show_pictures li.showing').next();
- $activeM = $jquery('ul.show_menu li.showing_menuitem').next();
- if ($active.length === 0) {
- $active = $jquery('ul.show_pictures li:first');
- $activeM = $jquery('ul.show_menu li:first');
- }
- rotate();
- }, 5000);
- };
- rotateSwitch();
-
- $jquery('ul.show_pictures li').hover(function() {
- clearInterval(play);
- }, function() {
- rotateSwitch();
- });
- $jquery('ul.show_menu li').hover(function() {
- $activeM = $jquery(this);
- $activeMnr = $jquery('ul.show_menu li').index(this);
- //alert($activeMnr);
- $active = $jquery('ul.show_pictures li').eq($activeMnr);
- clearInterval(play);
- rotate();
- rotateSwitch();
- });
(oh and this is the html -- NO need for optimizing this one!!)
- <div id="slideshow">
- <div class="show_pictures_container">
- <ul class="show_pictures">
- <li class="article_row cols1 clearfix">
- <div class="article_column column1">
- <div class="contentpaneopen">
- <div class="article-content">
- <a><img></a>
- </div>
- </div>
- </div>
- </li>
- <li class="article_row cols1 clearfix">
- <div class="article_column column1">
- <div class="contentpaneopen">
- <div class="article-content">
- <a><img></a>
- </div>
- </div>
- </div>
- </li>
- <li class="article_row cols1 clearfix">
- <div class="article_column column1">
- <div class="contentpaneopen">
- <div class="article-content">
- <a><img></a>
- </div>
- </div>
- </div>
- </li>
- </ul>
- </div>
- <div class="show_menu_container">
- <ul class="show_menu">
- <li>
- <a>
- </li>
- <li>
- <a>
- </li>
- <li>
- <a>
- </li>
- </ul>
- </div>
- </div><!-- end slideshow -->
Thanks for your time!
3Pinter