0

我正在使用 jQuery 和 fadeIn 淡入页面上的内容片段。它正确淡入,但问题是它在Android中自动淡入后立即淡出。:-\

有任何想法吗?

$(document).ready(function (){
    // Fancy intro animation
    $(".scroll-button").fadeIn(1000);

    // Smooth the scrolling
    $(".scroll-button").click(function(event){
            var bodyElement;

            event.preventDefault();

            if($.browser.safari) {
                bodyElement = $("body")
            } else {
                bodyElement = $("html,body")
            }

            bodyElement.animate({
                scrollTop: $('#headerimage').position().top
            }, 500);

            $('.bottom-image').hide();
            $(this.hash).fadeIn(1500);
    });
});
4

2 回答 2

1

So I found out that Android 2.3 doesn't handle click events and there are issues with it. Even attaching jQuery mobile (earlier versions) didn't work.

Eventually adding a div around the image and calling the div instead, worked. Go figure!

于 2012-12-10T22:06:05.170 回答
0

hash只属于location对象。您试图淡入一个不存在的元素(我怀疑 jQuery 构造函数实际上相当于 $(undefined))。

使用您发布的代码,$(this.hash).fadeIn(1500)正在寻找元素的hash属性。.scroll-button尝试将该行更改为:

$(window.location.hash).fadeIn(1500);
于 2012-12-10T20:12:42.230 回答