dimanche 30 mars 2014

i keep getting the error undefined variable. where am i going wrong?


Vote count:

0




i cant seem to find whats the problem im trying to create a simple ease scroll effect im using the jQuery pluging easing.js ans well as jquery-1.11.0.min.js



$(function(){
//catch all clicks
$("a").click(function(){
// check if it has a #
if(this.hash){
// get rid of the # sign
var hash = this.hash.substr(1);
// get position ofd the links name
var $toElement = $("a[name="+hash+"]");
var toPosition = $toElement.position().top;
// scroll animate to postion
$("body,html").animate({
scrollTop : toPosition
},2000,"easeOutExpo");
return false;
}
});
});


and even when i try it like this i still get the same error:



$(function(){
//catch all clicks
$("a").click(function(){
// check if it has a #
if(this.hash){
// get rid of the # sign
var hash = this.hash.substr(1);
// get position ofd the links name
var $toElement = $("a[name="+hash+"]");
var $toPosition = $toElement.position().top;
// scroll animate to postion
$("body,html").animate({
scrollTop : toPosition
},2000,"easeOutExpo");
return false;
}
});
});


asked 48 secs ago

code

23





Aucun commentaire:

Enregistrer un commentaire