PDA

Просмотр полной версии : конфликт jquery $ и mootools $


ufalog
06.01.2010, 00:16
<script type="text/javascript" src="/media/system/js/mootools.js"></script>
<script type="text/javascript" src="/media/system/js/caption.js"></script>
<script type="text/javascript" src="/modules/mod_accordionmenu/assets/accordionmenu.js"></script>





<script src='/templates/wmt/js/jquery.js' type='text/javascript'></script>
<script src='/templates/wmt/js/jquery.cross-slide.js' type='text/javascript'></script>
<script src='/templates/wmt/js/mootools.js' type='text/javascript'></script>






jquery.js и jquery.cross-slide.js используеться в -------->


<script type='text/javascript'>
jQuery(jQuery() {
jQuery('#test1').crossSlide({
fade: 1
}, [
{
src: 'http://spb.ufasearch.ru/templates/wmt/images/gorod/spb/1.jpg',
from: '100% 100% 1x',
to: '100% 100% 1x',
time: 4
}, {
src: 'http://spb.ufasearch.ru/templates/wmt/images/gorod/spb/2.jpg',
from: '100% 100% 1x',
to: '100% 100% 1x',
time: 4
},

{
src: 'http://spb.ufasearch.ru/templates/wmt/images/gorod/spb/3.jpg',
from: '100% 100% 1x',
to: '100% 100% 1x',
time: 4
},

{
src: 'http://spb.ufasearch.ru/templates/wmt/images/gorod/spb/4.jpg',
from: '100% 100% 1x',
to: '100% 100% 1x',
time: 4
}, {
src: 'http://spb.ufasearch.ru/templates/wmt/images/gorod/spb/5.jpg',
from: '100% 100% 1x',
to: '100% 100% 1x',
time: 4
}
]);
});
</script>


<div id='test1'>Loading...</div>




mootools.js -----------------------> используеться mod_accordionmenu

там есть accordionmenu.js



function accordionMenu(menuId, srcExpandImage, srcCollapseImage, accOptions, accHoverDelay, bDoHover) {
if($(menuId)){

// getting accordion parent items ("li" tags with class "parent")
$(menuId).accParentItems = [];

for(var i = 0; i < $(menuId).childNodes.length; i++) {

if($(menuId).childNodes[i].className.indexOf('parent') >= 0){
$(menuId).accParentItems.push($(menuId).childNodes[i]);
}
}


$(menuId).accTogglers = [];
$(menuId).accElements = [];
var startItem = -1;

for(var i = 0; i < $(menuId).accParentItems.length; i++) {

if(srcExpandImage.length > 0){

// creating accordion togglers
var accToggler = document.createElement("img");

accToggler.setAttribute("title","Expand");
accToggler.setAttribute("src",srcExpandImage);
}
else
{
var accToggler = document.createElement("span");
}
$(menuId).accParentItems[i].insertBefore(accToggler, $(menuId).accParentItems[i].firstChild);

$(menuId).accTogglers.push(accToggler);


// accordion elements
$(menuId).accElements.push($(menuId).accParentItem s[i].getElementsByTagName('ul')[0]);

// searching for active menu item to make the accordion show its sub-items when page loads
if ( $(menuId).accParentItems[i].className.indexOf('active') >= 0 ) {
startItem = i;
}
}

//create our Accordion instance
if ( $(menuId).accParentItems.length > 0 ){
$(menuId).Accordion = new Accordion($(menuId).accTogglers, $(menuId).accElements, $merge({
opacity: false,
alwaysHide: true,
show: startItem,
duration: 600,
transition: Fx.Transitions.Bounce.easeOut,

onActive: function(toggler, element){
element.parentNode.parentNode.setStyle('height', 'auto');
toggler.setAttribute("src", srcCollapseImage);
toggler.setAttribute("title","Collapse");
},
onBackground: function(toggler, element){
element.parentNode.parentNode.setStyle('height', 'auto');
element.setStyle('height', element.offsetHeight+'px');
toggler.setAttribute("src", srcExpandImage);
toggler.setAttribute("title","Expand");
}

}, accOptions)

);
}


accTimer = null;
if (!accHoverDelay) var accHoverDelay = 200;

for(var i = 0; i < $(menuId).accParentItems.length; i++) {

eval("function accOnclickFunc(){return function(){ if( $('"+menuId+"').accElements["+i+"].style.height == '0px' ) { $('"+menuId+"').Accordion.display("+i+") }}}");
eval("function accOnMouseoverFunc(){return function(){if( $('"+menuId+"').accElements["+i+"].style.height == '0px' ){accTimer = $('"+menuId+"').Accordion.display.delay("+accHoverDelay+", $('"+menuId+"').Accordion, "+i+");}}}");
eval("function accOnmouseoutFunc(){return function(){if($defined(accTimer)){$clear(accTimer) ;}}}");

$(menuId).accParentItems[i].firstChild.nextSibling.onclick = accOnclickFunc();
if (bDoHover==1) {
$(menuId).accParentItems[i].firstChild.nextSibling.onmouseover = accOnMouseoverFunc();
}
$(menuId).accParentItems[i].firstChild.nextSibling.onmouseout = accOnmouseoutFunc();
}


for(var i = 0; i < $(menuId).accElements.length; i++) {
$(menuId).accElements[i].setAttribute('id', menuId+'_'+i);
accordionMenu(menuId+'_'+i, srcExpandImage, srcCollapseImage, accOptions, accHoverDelay, bDoHover)
}

}
}






счас на http://ufasearch.ru/index.php работает тока менюшка на mootools/// а галерея на основе jquery не работает!!! (работу можно посмотреть на сайте rostov.ufasearch.ru )

astrologer
06.01.2010, 01:18
jQuery(jQuery() {>>jQuery.noConflict();
jQuery(function(){

ufalog
06.01.2010, 02:21
jQuery(jQuery() {>>jQuery.noConflict();
jQuery(function(){

спасибо! :) коротко и ясно