move() element on window.resize() function not working on Android
This is the move() function
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
});
}
}
Any idea why is this workin开发者_如何转开发g in desktop (all browsers), iphone, .. but not in Android?
I'm pretty certain scrollLeft doesn't work on android for some reason. Works beautifully on iOS, but I could never get it to work on android. Give it a test and see if you are actually getting a value back for it.
Edit: not just the function scrollLeft(), but really anything to do with horizontal scrolling doesn't seem to work in android.
A workaround I'm using to get things to actually move left/right is are the css properties:
-webkit-transform -webkit-transition-property -webkit-transition-timing-function -webkit-transition-duration
However that might not work for you since you're really just trying to get the value rather than actually move something.
精彩评论