• Resolved c-m

    (@c-m)


    Can anyone see any reason why this simple script doesn’t work with the WordPress included jquery (v1.11 -1.12)?

    <script type="text/javascript">
    
    $(document).ready(function () {
    
        $(window).scroll(function () {
            if ($(this).scrollTop() > 500) {
                $('.scrollup').fadeIn();
            } else {
                $('.scrollup').fadeOut();
            }
        });
    
        $('.scrollup').click(function () {
            $("html, body").animate({
                scrollTop: 0
            }, 900);
            return false;
        });
    
    });
    </script>

    It’s a simple script for a back-to-top button. If I manually load jquery 2.x from Google or elsewhere, it works just fine.

Viewing 1 replies (of 1 total)
  • Thread Starter c-m

    (@c-m)

    Solved.

    It’s due to wordpress loading jQuery in no conflict mode.

    Either replacing $ with jQuery, or setting $ as a function of jQuery on document ready works.

Viewing 1 replies (of 1 total)
  • The topic ‘WordPress jQuery version issues’ is closed to new replies.