jQuery исчезает в fadeOut - IE8 не исчезает - PullRequest
19 голосов
/ 04 мая 2010

Может кто-нибудь сказать мне, почему .jpg не будет исчезать или исчезать в IE8. Прямо сейчас это просто исчезает и появляется снова без изменений непрозрачности. У меня это настроено локально и на сервере публикации, странно то, что изображения локально постепенно исчезают и исчезают, только когда я иду на сервер публикации, они перестают исчезать.

Просто интересно, если я что-то упустил, кто-то мог бы быстро помочь мне с макушки головы.

Вот gcRotateContent, который находится на сервере публикации. Если я просто выбрасываю изображение и делаю его постепенным исчезновение, оно работает, по какой-то причине оно не работает с этой разметкой.

<div class="gcRotateContent">
   <div id="USCFRR2EN" class="gcEmployeeProfile">
      <div class="gcEmployeeProfileHeading">
         Meet John</div>
      <div class="gcEmployeeProfileContent">
         <div class="gcEmployeeProfileHRPad">
         </div>
         <div class="gcEmployeeProfileHR">
         </div>
         <div class="gcEmployeeProfileHRPad">
         </div>
         <div class="gcEmployeeProfileSLVideo">
            <img src="/PublishingImages/Profile_JOHN-190x96.jpg" alt="Portrait of employee John."
               height="96" width="190"></div>
         <div class="gcEmployeeProfileName">
         </div>
         <div class="gcEmployeeProfileTitle">
            Software Development Lead, Server Performance</div>
         <div class="gcEmployeeProfileQuote">
            “You will find no other company with the sheer breadth of technologies. The things you get to see and learn from other
            people are amazing.”</div>
      </div>
      <div class="gcEmployeeProfileFooter">
      </div>
   </div>
</div>

<div class="gcRotate">
      <div class="gcRotateContent">
         <div style="border: solid 2px black; text-align: center; width: 150px;">
            This is first content
            <img src="http://pix.motivatedphotos.com/2008/6/16/633492359109161542-Skills.jpg"
               alt="First" />
         </div>
      </div>
      <div class="gcRotateContent">
         <div style="border: solid 2px black; text-align: center; width: 150px">
            This is second content
            <img src="http://www.funnycorner.net/funny-pictures/5010/cheezburger-locats.jpg"
               alt="Second" />
         </div>
      </div>
      <div class="gcRotateContent">
         <div style="border: solid 2px black; text-align: center; width: 150px">
            This is third content
            <img src="http://icanhascheezburger.files.wordpress.com/2007/06/business.jpg" alt="Third" />
         </div>
      </div>
   </div>



   <div>
      This shouldn't move.
   </div>

   <script type="text/javascript">
      function fadeContent() {

         $(".gcRotateContent").first().customFadeOut(500, function() {
            $(".gcRotateContent:hidden:first").customFadeIn(500)
         });
         $(".gcRotateContent").first().appendTo($(".gcRotateContent").parent());
      }

      $(".gcRotate").height(0);

      $(".gcRotateContent").each(
         function() {
            if ($(".gcRotate").height() < $(this).height()) {
               $(".gcRotate").height($(this).height());
            }
         }
         );

      $(".gcRotateContent").each(function() {
         $(this).css("display", "none")
      });

      $(".gcRotate").hover(function() { window.clearInterval(timer) }, function() { timer = window.setInterval("fadeContent()", 2000) });

      $(".gcRotateContent").first().show(0);
      var timer = window.setInterval("fadeContent()", 2000);

      (function($) {
         $.fn.customFadeIn = function(speed, callback) {
            $(this).fadeIn(speed, function() {
               if (jQuery.browser.msie)
                  $(this).get(0).style.removeAttribute('filter');
               if (callback != undefined)
                  callback();
            });
         };
         $.fn.customFadeOut = function(speed, callback) {
            $(this).fadeOut(speed, function() {
               if (jQuery.browser.msie)
                  $(this).get(0).style.removeAttribute('filter');
               if (callback != undefined)
                  callback();
            });
         };
      })(jQuery);
   </script>

Ответы [ 5 ]

59 голосов
/ 02 сентября 2010

Видимо, есть обходной путь!

Просто установите элементы абсолютного / относительного расположения для следующих атрибутов css:

opacity:inherit;
filter:inherit;

например:

<div>
<img id='myImg' src='http://mydomain.com' style='position:absolute;top:10px;left:5px;filter:inherit;opacity:inherit' />
</div>

Веселись,

Омер

6 голосов
/ 04 мая 2010

Я понял, css установил положение: относительно изображения, по-видимому ie8 не нравится, есть ли обходной путь, интересно, поиск начинается.

1 голос
/ 23 июня 2013

Для быстрого и грязного исправления (или если приведенные выше предложения просто не работают, как в моем случае), вы можете просто заменить jQuery fadeIn / fadeOut на show / hide. Так что в html сделать:

<!--[if IE]>
<script type="text/javascript src="ieFixes.js"></script>
<![endif]-->

и в некоторых файлах javascript IE хаков (например, ieFixes.js) поставить:

jQuery.fn.fadeIn = function() {
    this.show();
}

jQuery.fn.fadeOut = function() {
    this.hide();
}

Вам придется немного подправить это, если вы используете цепочку анимированных вызовов и т. Д.

1 голос
/ 13 июля 2012

У меня просто была эта проблема, и все галочки css не работали. FadeIn / Out работал на FF и Chrome, но не в IE8, элемент вообще не обнаруживался. В IE7 они просто перешли из невидимого в видимое.

Итак, чтобы решить мою проблему, я просто хотел сохранить fadeIn / Out в других браузерах и сделать так, чтобы элементы появлялись в IE8. Решением было использовать обратный вызов так:

$(".elements").fadeIn("slow",function(){$(this).show()}):
$(".elements").fadeOut("slow",function(){$(this).hide()}):

Таким образом, я всегда получаю желаемый результат в конце.

0 голосов
/ 04 мая 2010

Замените ваше изображение на div (того же размера) на фоновое изображение и добавьте / вычеркните div.

<div style="background-image:url('paper.gif');height:xxxpx;width:xxxpx"></div>
...