-1

下にスクロールするときに「トップに戻る」ボタンを表示するために、次の JavaScript を使用しています。

これは Firefox では問題なく機能しますが、Chrome/Safari では機能しません。

jQuery(document).ready(function(){
    jQuery("#totop").hide();
    jQuery(window).scroll(function(){
        if (jQuery(this).scrollTop() > 100) {
            jQuery('#totop').fadeIn();
        } else {
            jQuery('#totop').fadeOut();
        }
    });
            
    jQuery('#totop').click(function(){
        jQuery("html, body").animate({ scrollTop: 0 }, 660, 'easeInOutExpo');
        return false;
    });
});

デモサイトhttp://demov3.joostrap.com

noConflict を使用してみました。

4

1 に答える 1

1

コメントで述べたように、固定位置と z-index に関して、Google Chrome およびその他の WebKit ブラウザーには既知の問題があります。

ページのソースを確認して、次の変更をお勧めします。

<-- Set the body element z-index value to 0 (inline or 
    on the CSS stylesheet) -->
<body class="com_content view-featured layout- task- frontpage itemid-101 no-rtl" style="z-index: 0;">

    <div class="body-wrapper">
        ...
    </div>

    <-- Stick the link as the last element within the body element, and change
        its z-index value to 9999 (on the CSS stylesheet) -->
    <a href="#" id="totop"></a>
</body>
于 2013-10-16T14:06:11.297 に答える