无法解决Jquery和Mootools冲突
我是初学者... 我使用了两个 Jquery(一个是用于弹出的 Jquery - Color Box 中的“某种 ajax”,另一个是用于加载更多再次获取数据的选项的 Jquery - 再次 Ajax),它与 Mootools(对于日历功能)发生冲突/冲突。 这是我的调用代码..
<script type="text/javascript" src="cal/js/mootools-1.2.4-core.js"></script>
<script type="text/javascript" src="cal/js/mootools-1.2.4.4-more.js"></script>
<script type="text/javascript" src="cal/js/calendar-eightysix-v1.1.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script src="javascripts/popup-jquery/jquery.popup.googleapis.js"></script>
<script src="javascripts/popup-jquery/jquery.colorbox.js"></script>
<script type="text/javascript">
jQuery.noConflict();
// For jQuery scripts
(function($){
$(document).ready(function(){
//Calling Pop-up
$(".example5").colorbox();
//Calling More Button
$('.more').live("click",function()
{
var ID = $(this).attr("id");
if(ID)
{
$("#more"+ID).html('<img src="load/moreajax.gif" />');
$.ajax({
type: "POST",
url: "load/ajax_more_calender_content.php",
data: "lastmsg="+ ID,
cache: false,
success: function(html){
$("div#updates").append(html);
$("#more"+ID).remove();
}
});
}
else
{
$(".morebox").html('The End');
}
return false;
});
});
})(jQuery);
(function($) {
window.addEvent('domready', function() {
//Example XIII
var calendarXIII = new CalendarEightysix('exampleXIII', { 'injectInsideTarget': true, 'alwaysShow': true,'draggable': true, 'pickable': true });
calendarXIII.addEvent('rendermonth', function(e) {
//The event returns all the date related elements within the calendar which can easily be iterated
e.elements.each(function(day) {
day.set('title', day.retrieve('date').format('%A %d %B'));
day.setStyles({ 'cursor': 'pointer' }).addEvent('click', function() { window.location='../calender.php?date='+day.retrieve('date').get('date')+'&month='+day.retrieve('date').get('month')+'&year='+day.retrieve('date').get('year'); } );
});
});
calendarXIII.render(); //Render again because while initializing and doing the first render it did not have the event set yet
});
})(document.id);
</script>
我已经阅读了许多论坛并以上述方式实现了它,工作代码只是弹出和加载更多选项(jQuery)而不是日历(mootools)。 并且代码仍然无法正常工作...任何帮助都将非常感激...!!!! 谢谢你
I am a beginner...
I have used Two Jquery ( One is Jquery For Pop up-"Kind Of ajax" from Color Box and Another is Jquery for Load More Options that Fetches Data-Again Ajax) It is Clashing/Conflicting with Mootools(For Calender Functionality).
here is My Calling Code..
<script type="text/javascript" src="cal/js/mootools-1.2.4-core.js"></script>
<script type="text/javascript" src="cal/js/mootools-1.2.4.4-more.js"></script>
<script type="text/javascript" src="cal/js/calendar-eightysix-v1.1.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script src="javascripts/popup-jquery/jquery.popup.googleapis.js"></script>
<script src="javascripts/popup-jquery/jquery.colorbox.js"></script>
<script type="text/javascript">
jQuery.noConflict();
// For jQuery scripts
(function($){
$(document).ready(function(){
//Calling Pop-up
$(".example5").colorbox();
//Calling More Button
$('.more').live("click",function()
{
var ID = $(this).attr("id");
if(ID)
{
$("#more"+ID).html('<img src="load/moreajax.gif" />');
$.ajax({
type: "POST",
url: "load/ajax_more_calender_content.php",
data: "lastmsg="+ ID,
cache: false,
success: function(html){
$("div#updates").append(html);
$("#more"+ID).remove();
}
});
}
else
{
$(".morebox").html('The End');
}
return false;
});
});
})(jQuery);
(function($) {
window.addEvent('domready', function() {
//Example XIII
var calendarXIII = new CalendarEightysix('exampleXIII', { 'injectInsideTarget': true, 'alwaysShow': true,'draggable': true, 'pickable': true });
calendarXIII.addEvent('rendermonth', function(e) {
//The event returns all the date related elements within the calendar which can easily be iterated
e.elements.each(function(day) {
day.set('title', day.retrieve('date').format('%A %d %B'));
day.setStyles({ 'cursor': 'pointer' }).addEvent('click', function() { window.location='../calender.php?date='+day.retrieve('date').get('date')+'&month='+day.retrieve('date').get('month')+'&year='+day.retrieve('date').get('year'); } );
});
});
calendarXIII.render(); //Render again because while initializing and doing the first render it did not have the event set yet
});
})(document.id);
</script>
I Have Read in Many Forums and implemented it in the above mentioned manner, the Working Code is only the Pop-up And Load More Option(jQuery) But not Calender(mootools).
and still the code is not working... Any Help will be Highly appreciable...!!!!
Thanking You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在修复实例化,但日历选择器插件使用的是
document.id
还是$
?此日历脚本具有诸如this.target = $(target);
之类的内容 - 编辑它并修复为document.id
或放入像实例化这样的闭包中。另外,您应该最后加载 mootools 及其依赖项 - 如果在其他地方定义了
$
,则自 v1.2.4 起它会自动恢复为document.id
。你可能还想看看 mootools forge 上的 Arian's DatePicker,它适用于 mootools 1.3+,并且以不冲突的方式编写。you are fixing your instantiation but is the calendar picker plugin using
document.id
or$
? this calendar script has things likethis.target = $(target);
- edit it and fix todocument.id
or put in a closure like your instantiation.also, you should load mootools and its dependencies last - if
$
is defined elsewhere, it automatically reverts todocument.id
since v1.2.4. you may also want to look at Arian's DatePicker on the mootools forge, it's for mootools 1.3+ and is written in a way that does not clash.