javascript - jQuery conflict with MooTools -
- i have created slideoutmenu pops out/in if touch it/not cursor using mootools: //mootools, http://mootools.net, object oriented (javascript) tools. copyright (c) 2006-2009 valerio proietti, http://mad4milk.net, mit style license. //core +fx.scroll +asset +event delegation
a part of script:
window.addevent('domready', function() { new slideoutmenu(); initialize: function() { // ff2 mac screws menu display. give m basic menu if (browser.platform.mac && browser.engine.gecko && browser.engine.version == 18) { $('menu').removeclass('js_live'); return; } // iphone should have normal menu if (browser.platform.ipod) { $('menu').removeclass('js_live'); return; } this.bg_div = $('menu'); this.menu_div = $$('#menu #opts')[0]; this.logo_lnk = $$('#logo a')[0]; if (this.logo_lnk.hasclass('home')) { this.is_homepage = true; } var rbseasing = new fx.transition(fx.transitions.expo, 4); this.is_open = false; this.bgeffect = new fx.tween(this.bg_div, { unit: '%', property: 'width', duration: 650, transition: rbseasing.easeout, oncomplete:this.bgeffectcomplete.bind(this) }); this.menueffect = new fx.tween(this.menu_div, { property: 'left', transition: rbseasing.easeout, duration: 650 }); $('logo').addevent('mouseenter', this.showmenu.bind(this)); this.mousebindcallback = this.movemovecallback.bind(this); }, bgeffectcomplete: function() { if (this.is_open === false) { document.addevent('mousemove', this.mousebindcallback); } this.is_open = !this.is_open; }, showmenu: function() { if (this.is_open === true) { return; } this.bgeffect.start(70); this.menueffect.start(600, $('logo').getposition().x); this.logo_lnk.addclass('active'); if (this.is_homepage) { this.logo_lnk.removeclass('home'); } }, hidemenu: function() { this.bgeffect.start(0); this.menueffect.start(600); this.logo_lnk.removeclass('active'); if (this.is_homepage) { this.logo_lnk.addclass('home'); } }, movemovecallback: function(e) { var close_right = this.menu_div.getposition().x + 370; if (e.page.x > close_right && e.page.y > 80 && this.is_open === true) { document.removeevent('mousemove', this.mousebindcallback); this.hidemenu(); } }
the menu worked without problem, then
i created photo slideshow gallery using jquery , of course menu stopped working. when remove jquery works fine again. there many sites says there conflict between javascript , jquery , not recommenced use them together, though there solution
jquery.noconflict(); should added after
also i've changed $ $j in mootools file jsc.js , 1 created myself. worked weirdly, menu pop out, elements not aligned anymore , wouldn't disappear when moved cursor away... have feeling there simple solution this, it's because lack of knowledge here asking help
try replace in mootools script $
(one dollar! not 2 $$
) document.id
Comments
Post a Comment