jQuery和Mootools,.noConflict失败
我有一个需要使用mootools日历的应用程序,但是,我将jquery用于我的主要应用程序结构.
I have an application that requires the use of a mootools calendar, however, I use jquery for my main app structure.
我在使用jquery的mootools时,都无法正常工作,而当我只有一个时,它们就可以正常工作.我进行了一些研究,说我可以使用一种名为.noconflict的方法,尽管尝试了一下,但仍未解决问题.也许有人可以更好地向我解释在哪里进行实际的.noconflict呼叫,也许可以帮助我完成此工作.
As soon as I have mootools in with jquery, neither work, and when I have only one, they work fine. I did some research saying I could use a method called .noconflict, and while i've tried, I have not gotten it to solve my issue. Perhaps someone could better explain to me where to do the actual .noconflict calls, and perhaps help me get this working.
谢谢!
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
var fixHeight = function () {
var gutter = 50;
var newHeight = $(window).height() - (gutter*2);
$('#container').height(newHeight);
}
$(function(){
fixHeight();
$('ul#nav li.item').each(function(index) {
if ($(this).attr("name") == "media") {
$(this).attr("id","active");
}
});
$('input').focus(function() {
$(this).attr("value","");
}).blur(function() {
$(this).attr("value",$(this).attr("original-value"));
});
$(window).resize(function() {
fixHeight();
}).load(function() {
fixHeight();
});
});
</script>
<script type="text/javascript" src="http://taptouchclick.com/js/mootools-1.2.4-core-yc.js"></script>
<script type="text/javascript">
window.addEvent('domready', function(){
var smoothCalendar = new SmoothCalendar("calendar");
});
</script>
如果您简单地致电:
jQuery.noConflict();
...包括Mootools JS文件之前.
...before including the Mootools JS file.
然后可以通过使用jQuery
而不是$
来使用jQuery函数.示例:
You can then use jQuery functions by using jQuery
instead of $
. Example:
jQuery('.selector').hide(); // instead of $('.selector').hide();