http://jsfiddle.net/uTV5k/19/
こんにちは、
私は自分のモバイルサイトで以下のスクリプトを使用しています。シミュレートされたスクリプトとマークアップのjsfiddleを見てください。
以下のスクリプトはまさに私のモバイルサイトにあるもので、jsフィドルはそれの複製です。
jsfiddleでは、クリック交互にうまく動作します。最初のクリックでアニメーションが開き、2回目のクリックでアニメーションが閉じます。
The problem on my mobile site, the first click opens the animation, and the second animation runs immediately after with-out a second click. But in the fiddle it runs OK.
$(window).load(function(){
$(window).bind("orientationchange resize", function(e) {
$('.home-mod').each(function() {
var homeModule = $(this).height(),
homeTitle = $(this).find('.home-title-button').outerHeight(),
homeStart = homeModule - homeTitle,
homeOpen = false;
$(this).find('.mod-info').css("top", homeStart + "px");
$(this).on('click', function() {
if (homeOpen) {
//second click alternation
$(this).find('.mod-info').animate({ top: homeStart + "px" });
homeOpen = false;
} else {
//first click alternation
$(this).find('.mod-info').animate({ top: 0 });
homeOpen = true;
}
});
});
}).trigger("resize");
});
I'm really not sure why this would be happening. Using this in iScroll shouldnt cause any problems should it?
Thanks in advance