Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scrollTo is not a function

Ok, I can't see it anymore. I'm using the scrollTo plugin and have a scrollTo function in my website. It worked and now suddenly it doesn't...

This is my code:

$(document).ready(function() {
    $('header').delay(300).fadeIn(750);
    $('#intro_text').delay(800).fadeIn(750);
    $("#jquery_jplayer_1").jPlayer({
        ready: function () {
            $(this).jPlayer("setMedia", {
                m4v: "mi4.m4v",
                ogv: "mi4.ogv",
                webmv: "mi4.webm",
                poster: "mi4.png"
            });
        },
        swfPath: "js",
        supplied: "webmv, ogv, m4v",
        size: {
            width: "570px",
            height: "340px",
            cssClass: "jp-video-360p"
        }
    });
});

$(function(toDemos) {
 $('h1').click(function() {
        $.scrollTo('#intro', 800);
    });
});

$(function(toDemos) {
 $('#contact').click(function() {
        $.scrollTo('footer', 800);
    });
});

$(function(toDemos) {
 $('#demos').click(function() {
        $.scrollTo('#content', 800);
    });
});

$(function(toDemos) {
 $('#toTop').click(function() {
        $.scrollTo('#intro', 800);
    });
});

$(function() {
    $("#playlist li").on("click", function() {
        $("#videoarea").attr({
            "src": $(this).attr("movieurl"),
            "poster": "",
            "autoplay": "autoplay"
        })
    })
    $("#videoarea").attr({
        "src": $("#playlist li").eq(0).attr("movieurl"),
        "poster": $("#playlist li").eq(0).attr("moviesposter")
    })
})

I'm just a beginner at this, but I don't think I did much wrong. Is there anything wrong here? I can't see it.

Hopefully one of you can! Much thanks in advance.

like image 373
Luc Avatar asked May 02 '13 18:05

Luc


1 Answers

If you're using flesler's scrollTo plugin, you may need to modify the duration option:

$.scrollTo('footer', { duration:800 });

Download the plugin source here if you haven't already. I would verify that it is correctly linked to your code. Also try a debugging tool like firebug to help with the troubleshooting.

NOTE:

To point out Mark's answer in the comments below for anyone who stumbles on this, jQuery must be linked first in order in the file before any plugins are loaded. E.g.:

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.scrollTo.min.js"></script>
like image 120
Brian Phillips Avatar answered Oct 07 '22 11:10

Brian Phillips