title: jQuery - Custom Gallery - Works in FF, Chrome, Safari & IE8, but not IE7 - pointers?
body: <p>I'm really baffled with the following.  </p>
  
  <p>When the gallery is created in FF/Chrome etc, clicking next moves the image on one and the hover state remains for you to click again.  In IE7, the image moves on one, then the hover state fails, and doesn't reappear.  Other effects I have on my page continue to function.</p>
  
  <p>My jQuery may not be the best, so I apologise for the mess.  Other than the problem at hand, any general jQuery pointers welcome.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm11-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" &gt;
  &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt;
      &lt;meta name="author" content="" /&gt;
      &lt;meta name="keywords" content="" /&gt;
      &lt;meta name="description" content="" /&gt;
      &lt;meta name="robots" content="all" /&gt;
  
      &lt;title&gt;GA - 2009 yee haw&lt;/title&gt;
      &lt;script type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/js/jquery-1.3.2.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/js/jquery.dimensions.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/js/jquery.easing.1.3.js"&gt;&lt;/script&gt;
      &lt;style type="text/css" media="all"&gt;
          @import "/css/screen.css";
      &lt;/style&gt;
  &lt;/head&gt;
  
  
  &lt;body&gt;
  
  
  
  
  
              &lt;script type="text/javascript"&gt;
                  &lt;!--//
                  function DrawGalleryOptions(div) {
  
                      $('gallery').css({width: '503px'});
                      $(div).append('&lt;div class="gallery-title"&gt;&lt;p style="font-size:14px;"&gt;no title&lt;/p&gt;&lt;div class="gallery-bg gallery-bg-small"&gt;&lt;/div&gt;&lt;/div&gt;');
                      $(div).append('&lt;div class="gallery-nav"&gt;&lt;/div&gt;');
                      $('.gallery-nav').append('&lt;div class="gallery-bg"&gt;&lt;/div&gt;&lt;div class="gallery-controls"&gt;&lt;p class="gall-title"&gt;&lt;a class="gallleft" href="#galleryleft" title=""&gt;Previous Image&lt;/a&gt;&lt;a class="gallright" href="#galleryright" title=""&gt;Next Image&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;');
  
                      $('.gallery-title, .gallery-nav, .gallery-bg').css({ position: 'absolute', left: '0px', height: '30px', width: '503px' });
                      $('.gallery-nav').css({ height: '60px', bottom: '-60px' });
                      $('.gallery-bg').css({ backgroundColor: '#5974c5', opacity: 0.7, height: '60px', zIndex: 1000 });
                      $('.gallery-title').css({ top: '-30px'});
                      $('.gallery-controls').css({ position: 'absolute', zIndex: 1002 });
                      $('.gallery-bg-small').css({height: '30px'});
                      $('.gallery-title p').css({zIndex: 1002, color: '#ffffff', position: 'absolute', padding: '5px'});
                      $('.gallery-controls p').css({ posistion: 'absolute', zIndex: 1005, left: '0px', top: '0px' });
                      $('a.gallleft').css({ width: '82px', height: '45px', display: 'block', textIndent: '0', backgroundImage: 'url(/image/galleryleft.gif)', backgroundPosition: 'left top', backgroundRepeat: 'no-repeat', fontSize: '11px', color: '#ffffff', top: '15px', left: '15px', position: 'absolute', paddingTop: '25px' });
                      $('a.gallright').css({ width: '53px', height: '45px', display: 'block', textIndent: '0', backgroundImage: 'url(/image/galleryright.gif)', backgroundPosition: 'right top', backgroundRepeat: 'no-repeat', fontSize: '11px', color: '#ffffff', top: '15px', left: '430px', position: 'absolute', paddingTop: '25px' });
                  }
  
                  function ShowGalleryOptions() {
  
                      jQuery.easing.def = "easeOutQuint";
                      $('.gallery-title').animate({ top: '0px' }, 800);
                      $('.gallery-nav').animate({ bottom: '0px' }, 800);
  
                  }
  
                  function HideGalleryOptions() {
  
                      $('.gallery-title').animate({ top: '-30px' }, 800);
                      $('.gallery-nav').animate({ bottom: '-60px' }, 800);
  
                  }
  
                  function StopAll() {
  
                      $('.gallery-title').stop();
                      $('.gallery-nav').stop();
  
                  }
  
  
                  function MoveGallery(pic) {
  
                      $('#test2').html('&gt;&gt; &lt;br /&gt;' + pic[_GalleryCurrent].src + " " + pic[_GalleryCurrent].height + " " + pic[_GalleryCurrent].width + "&lt;br /&gt;Current: " + _GalleryCurrent);
  
                      $('.gallery').append('&lt;img id="gallery-current" style="display:none;" src="' + pic[_GalleryCurrent].src + '" width="' + pic[_GalleryCurrent].width + '" height="' + pic[_GalleryCurrent].height + '" alt="' + pic[_GalleryCurrent].alt + '" /&gt;');
                      $('#gallery-current').css({ opacity: 0, display: 'block' });
                      $('.gallery img').css({ position: 'absolute', top: '0px', left: '0px' });
                      //jQuery.easing.def = "easeOutElastic";
  
                      $('.gallery-title p').html(pic[_GalleryCurrent].alt);
  
                      $('#gallery-current').animate({ opacity: 1 }, 1200, function() {
  
                          $('#gallery-last').remove();
                          $('#gallery-current').attr('id', 'gallery-last');
  
                      });
  
                  }
  
  
                  $(function() {
  
                      var pic;
                      pic = $(".gallery").children("img");
                      _GalleryMax = pic.length - 1;
                      _GalleryCurrent = 0;
  
                      //$('#test2').html('&gt;&gt;&lt;br /&gt;' + pic[_].src + " " + pic[0].height + " " + pic[0].width + "&lt;br /&gt;Current: " + _GalleryCurrent);
  
                      $('.gallery').css({ height: 283, overflow: 'hidden', position: 'relative' });
                      $('.gallery').html('');
  
                      DrawGalleryOptions('.gallery');
  
                      $('.gallery').append('&lt;img id="gallery-last" src="' + pic[_GalleryCurrent].src + '" width="' + pic[_GalleryCurrent].width + '" height="' + pic[_GalleryCurrent].height + '" alt="' + pic[_GalleryCurrent].alt + '" /&gt;');
                      $('.gallery-title p').html(pic[_GalleryCurrent].alt);
  
                      $('.gallery').hover(function() {
  
                          //alert('on');
                          StopAll();
                          ShowGalleryOptions();
  
                      },
                      function() {
  
                          //alert('off');
                          StopAll();
                          HideGalleryOptions();
  
                      });
  
                      $('a.gallright').click(function() {
  
                          $('#gallery-current').stop(false, true);
  
                          //alert('boota');
                          _GalleryCurrent = _GalleryCurrent + 1;
                          if (_GalleryCurrent &gt; _GalleryMax) {
                              _GalleryCurrent = 0;
                          }
  
                          MoveGallery(pic);
  
                      });
  
                      $('a.gallleft').click(function() {
  
                          $('#gallery-current').stop(false, true);
  
                          //alert('boota');
                          _GalleryCurrent = _GalleryCurrent - 1;
                          if (_GalleryCurrent &lt; 0) {
                              _GalleryCurrent = _GalleryMax;
                          }
  
                          MoveGallery(pic);
  
                      });
  
                  });
  
                  //--&gt;
  
              &lt;/script&gt;
  
              &lt;div class="gallery"&gt;
  
                  &lt;img class="gall-img" src="/image/gallery1.jpg" width="503" height="283" alt="Person on a lake" /&gt;
                  &lt;img class="gall-img" src="/image/gallery2.jpg" width="503" height="283" alt="Building university" /&gt;
                  &lt;img class="gall-img" src="/image/gallery3.jpg" width="503" height="283" alt="Random colours" /&gt;
                  &lt;img class="gall-img" src="/image/gallery4.jpg" width="503" height="283" alt="Abstract - dark blue?" /&gt;
                  &lt;img class="gall-img" src="/image/gallery5.jpg" width="503" height="283" alt="Random abstract" /&gt;
  
              &lt;/div&gt;
  
              &lt;div id="test2" style="font-size:18px;"&gt;&lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>any help greatly appreciated!!</p>
  
  <p>EDIT #1:
  Further to the above, I'd read that IE7 has issues with the img selector, but I've tried changing this to a generic classname etc to no avail.  Any more clues?</p>
  
  <p>EDIT #2:
  I'm still struggling with this - I've added a live example here:  (too new to add links it seems, sorry!)</p>