2011-09-30 127 views
0

工作這是移動()函數移動()元素功能無法在Android

function move(){ 
/*calculate*/ 
     var size = { x: $(window).width(),  y: $(window).height() }; 
     var scroll = { x: $(window).scrollLeft(), y: $(window).scrollTop() }; 
     var height = h!=null ? h : this.esqueleto.lightbox.outerHeight(); 
     var width = w!=null ? w : this.esqueleto.lightbox.outerWidth(); 
     var y  = 0; 
     var x  = 0; 

     //vertically center 
     x = scroll.x + ((size.x - width)/2); 

     if (this.visible) { 
      y = scroll.y + (size.y - height)/2; 
     } else if (this.options.emergefrom == "bottom") { 
      y = (scroll.y + size.y + 14); 
     } else {// top 
      y = (scroll.y - height) - 14; 
     } 
/*Process*/ 
if (!this.animations.move) { 
      this.morph(this.esqueleto.move, { 
       'left' : x 
      }, 'move'); 
      } 

      this.morph(this.esqueleto.move, { 
      'top' : y 
      }, 'move'); 

     } else { 

      this.esqueleto.move.css({ 
      'left' : x, 
      'top' : y 
      }); 
     } 

} 

任何想法,爲什麼是桌面(所有瀏覽器),iphone,這個工作..但不是在Android?

+0

構建一個簡單而抽象的測試用例,並在[jQuery Bug-Tracker](http://bugs.jquery.com)上提交一個錯誤。 –

回答

0

我很確定scrollLeft在android上出於某種原因不起作用。在iOS上工作得很好,但我永遠無法使它在Android上工作。給它一個測試,看看你是否真的獲得了它的價值。

編輯:不只是功能scrollLeft(),但真正做任何與水平滾動似乎並沒有在Android中工作。

我用得到的東西實際移動的一種解決方法左/右IS是CSS屬性:

-webkit-變換 -webkit-過渡性質 -webkit-過渡定時功能 -webkit-transition-duration

但是這可能對你不起作用,因爲你只是試圖獲得價值而不是實際移動某物。