2010-06-03 6 views
-2
<script type="text/javascript" src="jquery-1.js"></script> 
<script type="text/javascript" src="mootools.js"></script> 
<script type="text/javascript" src="slideshow.js"></script> 
<script type="text/javascript"> 
//<![CDATA[ 
    window.addEvent('domready', function(){ 
    var data = { 
     '1.jpg': { caption: 'Volcano Asención in Ometepe, Nicaragua.' }, 
     '2.jpg': { caption: 'A Ceibu tree.' }, 
     '3.jpg': { caption: 'The view from Volcano Maderas.' }, 
     '4.jpg': { caption: 'Beer and ice cream.' } 
    }; 
    var myShow = new Slideshow('show', data, {controller: true, height: 400, hu: 'images/', thumbnails: true, width: 500}); 
    }); 
//]]> 
</script> 
<script type="text/javascript"> 
$(document).ready(function() 
{ 
//slides the element with class "menu_body" when paragraph with class "menu_head" is clicked 
$("#firstpane p.menu_head").click(function() 
    { 
    $(this).css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow"); 
     $(this).siblings().css({backgroundImage:"url(left.png)"}); 
}); 
//slides the element with class "menu_body" when mouse is over the paragraph 
$("#secondpane p.menu_head").mouseover(function() 
    { 
     $(this).css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideDown(500).siblings("div.menu_body").slideUp("slow"); 
     $(this).siblings().css({backgroundImage:"url(left.png)"}); 
}); 
}); 
</script> 

<!--[if lt IE 7]> 
     <script type="text/javascript" src="unitpngfix.js"></script> 
<![endif]--> 
+3

그래서 문제가 정확히 무엇입니까? 무슨 갈등이야? – Marc

답변

2

jQuery를 포함시킨 후 $ .noConflict()를 호출해야합니다. 당신이 jQuery 코드를 호출 할 경우 jQuery를 대신 $를 사용해야합니다,이 시점에서

<script type="text/javascript" src="jquery-1.js"></script> 
<script> 
$.noConflict(); 
</script> 
<script type="text/javascript" src="mootools.js"></script> 

이 글로벌 네임 스페이스에서 "$"를 제거합니다. 또는 당신은 폐쇄에 $ 기호를 포장하여 트릭을 사용할 수

<script type="text/javascript"> 
jQuery(function($) { 
    // here you can use $ instead of jQuery 
}); 
</script> 
3

jQuery의 충돌 좋은 선택이 없다. 나는이 같은 일을하지만 좋을 것 : 줄 것

<script language=javascript> 
    var $j = jQuery.noConflict(); 
</script> 

당신은 $ 대신에 $의 J를 사용하여 jQuery의 기능에 액세스 할 수 있습니다. 이 방법을 사용하여 GreaseMonkey를 통해 대부분의 페이지에 jQuery를 포함시킵니다. 나는 위의 호출을 포함하는 jQuery의 커스텀 카피를 가지고있다. GreaseMonkey를 사용하여 해당 스크립트에 대한 링크를 웹 페이지의 머리 부분에 삽입하여 $ j를 사용하여 페이지에있는 다른 라이브러리에 영향을주지 않고 $를 사용하여 개체 속성을 조사 할 수 있습니다.

관련 문제