I'm using the scrollTo jquery library in a page I'm building, and it works with Chrome, Safari, and IE 8/9, but not with firefox. Firebug tells me,
TypeError: $("#wrapper").scrollTo is not a function
Here is the line that includes the scrollTo library
<script type="text/javascript" src="js/jquery.scrollTo.js"></script>
Here is the function where I use scrollTo
function scrollPage(currentpage,scrollpage) {
$(scrollpage).find('.text').fadeOut();
$(currentpage).find('.text').fadeOut( function(){
$('#wrapper').scrollTo( scrollpage, 1500, {
onAfter:function(){
$(scrollpage).find('.text').fadeIn();
}
});
});
}
Why would firefox not think scrollTo was a function, while all other browsers I've tried do?
EDIT: It seems that my files work on other puters, but not on my current install of firefox. I am going to re-install and see that helps.
I'm using the scrollTo jquery library in a page I'm building, and it works with Chrome, Safari, and IE 8/9, but not with firefox. Firebug tells me,
TypeError: $("#wrapper").scrollTo is not a function
Here is the line that includes the scrollTo library
<script type="text/javascript" src="js/jquery.scrollTo.js"></script>
Here is the function where I use scrollTo
function scrollPage(currentpage,scrollpage) {
$(scrollpage).find('.text').fadeOut();
$(currentpage).find('.text').fadeOut( function(){
$('#wrapper').scrollTo( scrollpage, 1500, {
onAfter:function(){
$(scrollpage).find('.text').fadeIn();
}
});
});
}
Why would firefox not think scrollTo was a function, while all other browsers I've tried do?
EDIT: It seems that my files work on other puters, but not on my current install of firefox. I am going to re-install and see that helps.
Share Improve this question edited Oct 24, 2012 at 18:16 dremme asked Oct 24, 2012 at 17:08 dremmedremme 7692 gold badges10 silver badges18 bronze badges 2- 1 Maybe a popup blocker... see here: github./mootools/mootools-core/issues/2202 – Stefan Commented Oct 24, 2012 at 18:16
- That it was. Kaspersky installed a security add on in firefox, and was blocking scrollTo. Thanks. If you want to edit your original answer, I will mark it as a solution – dremme Commented Oct 24, 2012 at 18:29
3 Answers
Reset to default 2SOLUTION:
Well, it seems a popup blocker caused a conflict! The OP found that Kaspersky installed a security add on in firefox, and was blocking scrollTo.
More: http://github./mootools/mootools-core/issues/2202
ORIGINAL POST:
I sometimes get that error when my jQuery code is not enclosed in a $(document).ready(function() {...your jquery statements here ...});
block.
Your function doesn't have to be inside doc ready but the statement that calls it should be.
Works for me (fiddle). Did you include jQuery in your html?
This is how you can do it (BEFORE your ScrollTo library, of course):
<script src="http://code.jquery./jquery-latest.min.js"
type="text/javascript"></script>
Instead of using scrollTo I used scrollIntoView and it worked in FireFox, Chrome and IE.
Example :
var element = document.querySelector('.navbar-brand');
element.scrollIntoView();
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742362584a4429676.html
评论列表(0条)