2009-05-21 1 views
0

나는 다음과 같이 정말로 당황 스럽다.jQuery - 맞춤 갤러리 - FF, Chrome, Safari 및 IE8에서 작동하지만 IE7에서는 작동하지 않습니까?

FF/Chrome 등에서 갤러리를 만들었 으면 다음을 클릭하면 이미지가 하나 이동되고 다시 가리 키기 상태가 유지됩니다. IE7에서는 이미지가 하나 이동 한 다음 가리 키기 상태가 실패하고 다시 표시되지 않습니다. 내 페이지에있는 다른 효과는 계속 작동합니다.

내 jQuery가 좋지 않을 수 있으므로 혼란에 대해 사과드립니다. 문제가 아닌 다른 일반적인 jQuery 포인터도 환영합니다.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm11-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > 
<head> 
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 
    <meta name="author" content="" /> 
    <meta name="keywords" content="" /> 
    <meta name="description" content="" /> 
    <meta name="robots" content="all" /> 

    <title>GA - 2009 yee haw</title> 
    <script type="text/javascript"></script> 
    <script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script> 
    <script type="text/javascript" src="/js/jquery.dimensions.min.js"></script> 
    <script type="text/javascript" src="/js/jquery.easing.1.3.js"></script> 
    <style type="text/css" media="all"> 
     @import "/css/screen.css"; 
    </style> 
</head> 


<body> 





      <script type="text/javascript"> 
       <!--// 
       function DrawGalleryOptions(div) { 

        $('gallery').css({width: '503px'}); 
        $(div).append('<div class="gallery-title"><p style="font-size:14px;">no title</p><div class="gallery-bg gallery-bg-small"></div></div>'); 
        $(div).append('<div class="gallery-nav"></div>'); 
        $('.gallery-nav').append('<div class="gallery-bg"></div><div class="gallery-controls"><p class="gall-title"><a class="gallleft" href="#galleryleft" title="">Previous Image</a><a class="gallright" href="#galleryright" title="">Next Image</a></p></div>'); 

        $('.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('>> <br />' + pic[_GalleryCurrent].src + " " + pic[_GalleryCurrent].height + " " + pic[_GalleryCurrent].width + "<br />Current: " + _GalleryCurrent); 

        $('.gallery').append('<img id="gallery-current" style="display:none;" src="' + pic[_GalleryCurrent].src + '" width="' + pic[_GalleryCurrent].width + '" height="' + pic[_GalleryCurrent].height + '" alt="' + pic[_GalleryCurrent].alt + '" />'); 
        $('#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('>><br />' + pic[_].src + " " + pic[0].height + " " + pic[0].width + "<br />Current: " + _GalleryCurrent); 

        $('.gallery').css({ height: 283, overflow: 'hidden', position: 'relative' }); 
        $('.gallery').html(''); 

        DrawGalleryOptions('.gallery'); 

        $('.gallery').append('<img id="gallery-last" src="' + pic[_GalleryCurrent].src + '" width="' + pic[_GalleryCurrent].width + '" height="' + pic[_GalleryCurrent].height + '" alt="' + pic[_GalleryCurrent].alt + '" />'); 
        $('.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 > _GalleryMax) { 
          _GalleryCurrent = 0; 
         } 

         MoveGallery(pic); 

        }); 

        $('a.gallleft').click(function() { 

         $('#gallery-current').stop(false, true); 

         //alert('boota'); 
         _GalleryCurrent = _GalleryCurrent - 1; 
         if (_GalleryCurrent < 0) { 
          _GalleryCurrent = _GalleryMax; 
         } 

         MoveGallery(pic); 

        }); 

       }); 

       //--> 

      </script> 

      <div class="gallery"> 

       <img class="gall-img" src="/image/gallery1.jpg" width="503" height="283" alt="Person on a lake" /> 
       <img class="gall-img" src="/image/gallery2.jpg" width="503" height="283" alt="Building university" /> 
       <img class="gall-img" src="/image/gallery3.jpg" width="503" height="283" alt="Random colours" /> 
       <img class="gall-img" src="/image/gallery4.jpg" width="503" height="283" alt="Abstract - dark blue?" /> 
       <img class="gall-img" src="/image/gallery5.jpg" width="503" height="283" alt="Random abstract" /> 

      </div> 

      <div id="test2" style="font-size:18px;"></div> 


</body> 
</html> 

대단히 감사합니다 !!

EDIT # 1 : 위의 내용 이외에도 IE7에 img 선택기와 관련된 문제가 있지만 일반 클래스 이름 등으로 변경할 것을 시도했습니다. 더 이상의 단서?

편집 # 2 : 나는 여전히이와 사투를 벌인거야 - 내가 여기 살아있는 예를 추가했습니다 : (! 너무 새가 보인다 링크를 추가하는 죄송합니다)

+0

http://gallery.andycopley.co.uk/gallery.htm –

+0

Ooh! 약간의 진전. 갤러리가 너무 높아서 예제를 수정했습니다. 이 예제를 사용하면 IE7에서 갤러리 컨트롤이 여전히 나타나지만 이미지는 BENEATH라는 것을 볼 수 있습니다. 그래서 Keith는 CSS 제안에 옳았습니다. 그래도이 문제를 해결할 수는 없지만 zIndex 속임수로 갤러리 컨트롤 아래에 이미지가 다시 표시되지는 않습니다. 간단하고 우아한 CSS 솔루션이 있다고 말해주세요.? –

답변

1

많은 재생 후 문제가 해결되었습니다. Keith는 CSS 버그라고 제안했습니다.

는 IE7은 몇 가지 요소가 있었다 Z- 색인 어떤 수준 조금 연상 필요, 그래서 나는 (단지 애니메이션 전) 이동 갤러리 함수 내부 다음

$('.gallery-nav, .gallery-title').css({ position: 'absolute', left: '0px', zIndex: '1100' }); // random reassignement of gallery zIndex, because IE7 doesn't behave 

을 삽입했다.

조이!

1

나는에 테스트 페이지를 넣어 추천을 다른 사람들이 IE7을 통해 우리 자신의 환경에서 볼 수 있도록 공개적으로 액세스 할 수있는 서버입니다.

우리는 상황을 훨씬 더 빨리보고 행동을 이해하고 진단 할 수 있습니다.

나는 코드p 일 수 있었지만 여전히 사진을 찾아야 만 검사 할 수 있습니다. http://getfirebug.com/lite.html를 그냥 다음과 같습니다 :

그때까지, IE에 대한 방화범 라이트를 확인

<script src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"></script> 

난 내 머리 위로 떨어져 같은데요 그것이 다른 브라우저와 작동 C/B jQuery를 사용하여 매우 잘 정규화되어 CSS 문제 일지 모르지만 예제 페이지가 표시 될 때까지는 간단히 추측 할 수 있습니다.

+0

파이어 버그 라이트 포인터는 마침내 나 한테 준거야. 정말 고마워. 내가 권력을 가졌다면 나는 너를 투표 할거야! –

+0

도와 드리겠습니다. 나는 당신이 대리인을 얻을 때 나를 투표 할 거라는 것을 안다. ;) 감사. –