According to my requirement..If i scroll down with 200px
. I should show a div in the top of the page which stick there. I worked with an jquery which is working fine in my personal PC. Where I placed the same thing in my working PC its not working fine and showing an
error (Uncaught TypeError: Object function (el, nc){
return document.id(el, nc, this.document);
} has no method 'noConflict')
my jquery is:
$.noConflict()
jQuery(window).scroll(function() {
jQuery('#menu1').toggle(jQuery(this).scrollTop() > 350);
});
In my project I have Mootools.I think the conflict was coming with that...can anybody please make sure of my code..
From the error you get I see that the $
is being used by Mootools.
Use jQuery
instead of $
and you should be fine. So try this:
jQuery.noConflict();
jQuery(window).scroll(function() {
jQuery('#menu1').toggle(jQuery(this).scrollTop() > 350);
});
You could also do it with MooTools:
window.addEvent('scroll', function () {
var scroll = window.getScroll().y;
scroll > 350 ? $('menu1').show() : $('menu1').hide();
});
Anyway, keep in mind MooTools uses the dollar sign to get a element by ID ($('myID')
), you can also use this instead: document.id('myID')
, they are the same.