2014-06-23 80 views
0

我已經在瓷磚下面的動畫元素在他們的z軸即(視覺),旋轉......它是下頁...jQuery的動畫在本地工作,但不能遠程

http://sthera.com/modelos.php

,並因此編碼(有點野蠻強制,如果一個更好的解決方案浮現在腦海中,將還可以理解的)...

$(window).load(function() { 
    imagesLoaded('.fixedWidth', function() { 
     console.log("animation starting3"); 
     var locationClean = window.location.href.split('?')[0]; 
     var loc = locationClean.split('sthera/')[1]; 
     //alert (loc); 

     if (loc == 'modelos.php' || loc == 'aislar.php') { 

      //alert ("animation starting2"); 

      var duration = 300; 
      var imgWidth = 123; 
      var delayFactor = 60; 
      var marginLeft = imgWidth/2; 
      //establecemos los valores de inicio 
      $(".a1, .a2, .a3, .a4, .a5, .a6, .a7").css({ 
       'width': '0px', 
        'margin-left': marginLeft + 'px', 
        'opacity': '0' 
      }); 
      $(".c1, .c2, .c3, .c4, .c5, .c6, .c7").css({ 
       'opacity': '0' 
      }); 

      $(".a1").delay(1 * delayFactor).animate({ 
       'width': imgWidth + 'px', 
        'margin-left': '0px', 
        'opacity': '1' 
      }, duration); 
      $(".c1").delay(1 * delayFactor + duration).animate({ 
       'opacity': '1' 
      }, duration); 

      $(".a2").delay(2 * delayFactor).animate({ 
       'width': imgWidth + 'px', 
        'margin-left': '0px', 
        'opacity': '1' 
      }, duration); 
      $(".c2").delay(2 * delayFactor + duration).animate({ 
       'opacity': '1' 
      }, duration); 

      $(".a3").delay(3 * delayFactor).animate({ 
       'width': imgWidth + 'px', 
        'margin-left': '0px', 
        'opacity': '1' 
      }, duration); 
      $(".c3").delay(3 * delayFactor + duration).animate({ 
       'opacity': '1' 
      }, duration); 

      $(".a4").delay(4 * delayFactor).animate({ 
       'width': imgWidth + 'px', 
        'margin-left': '0px', 
        'opacity': '1' 
      }, duration); 
      $(".c4").delay(4 * delayFactor + duration).animate({ 
       'opacity': '1' 
      }, duration); 

      $(".a5").delay(5 * delayFactor).animate({ 
       'width': imgWidth + 'px', 
        'margin-left': '0px', 
        'opacity': '1' 
      }, duration); 
      $(".c5").delay(5 * delayFactor + duration).animate({ 
       'opacity': '1' 
      }, duration); 

      $(".a6").delay(6 * delayFactor).animate({ 
       'width': imgWidth + 'px', 
        'margin-left': '0px', 
        'opacity': '1' 
      }, duration); 
      $(".c6").delay(6 * delayFactor + duration).animate({ 
       'opacity': '1' 
      }, duration); 

      $(".a7").delay(7 * delayFactor).animate({ 
       'width': imgWidth + 'px', 
        'margin-left': '0px', 
        'opacity': '1' 
      }, duration); 
      $(".c7").delay(7 * delayFactor + duration).animate({ 
       'opacity': '1' 
      }, duration); 

     } 

    }); 
}); //end animation() 
//JavaScript Document 

其中.a1 ... .a7被歸類圖像。

此代碼運行完全在我的本地測試服務器,但不能遠程...

我想這個問題可能有一些做與不被時間的$(document)。就緒加載圖片...跑了,所以我用其他用戶推薦的imagesLoaded插件... Preload images with JQuery to get dominant colour of image ...雖然沒有工作。代碼在圖片加載後運行,但顯然這不是問題。

(很多)在此先感謝。

+0

我剛剛注意到,您使用'animate2.js'而不是'animate.js'。你上面發佈的代碼在'animate.js'上。 - 只是一個觀察。 – dunli

+0

你是否在控制檯中獲得'console.log(「animation starting3」);'?我想知道腳本是否在運行。另外'loc'最終是什麼?我看到你注意到了警報,也許服務器的URL結構與本地不同,並且沒有任何內容正在運行,因爲'loc'是錯誤的或空的。 –

+0

謝謝... @dunli我發佈的代碼是animate.js,代碼非常相似... – JupiterPalace

回答

0

您是否在控制檯中獲得console.log("animation starting3");?我想知道腳本是否在運行。 loc最終是什麼?我看到你注意到了警報,也許服務器的網址結構與本地網址不同,沒有任何內容,因爲loc錯誤或爲空。

相關問題