2012-01-05 111 views
0

我是一個初學者... 我已經使用了兩個jquery(一個是JQuery的彈出 - 「顏色框的種類ajax」和另一個是Jquery的加載更多選項,獲取數據 - 再次Ajax)它是與Mootools衝突/衝突(對於日曆功能)。 這裏是我的長途區號..不能解決jquery和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的)。 仍然代碼不工作...任何幫助將非常明顯... !!!! 感謝你

+0

我記得我使用'$ .jQuery()'而不是'$()'來定義選擇器,但是在做這件事之前你應該做一件事情,我現在不記得了,互聯網。我認爲這是最好的方法,我用MooTools進行了測試,沒有發生任何衝突。 – MahanGM 2012-01-05 13:47:27

+0

謝謝先生...但是,jquery是工作它的Mootools不工作.... 我試過你的建議,但同樣的問題仍然Pan me我... – Akjethwani 2012-01-05 13:51:52

+0

在我以前的作品中找到它。首先,我做了一個'jQuery.noConflict();'接下來我使用'jQuery('')'作爲選擇器。試試這個,並報告我! – MahanGM 2012-01-05 14:04:29

回答

1

你正在修復你的實例,但是日曆選取器插件使用document.id$?這個日曆腳本有類似this.target = $(target);的東西 - 編輯它並修復到document.id或者像你的實例化那樣放入一個閉包。

此外,您應該最後加載mootools及其依賴關係 - 如果$在其他地方定義,它會自v1.2.4開始自動恢復爲document.id。你也可以在mootools forge上看看Arian的DatePicker,它是爲mootools 1.3+編寫的,而且是以不衝突的方式編寫的。

+0

謝謝主席先生其實ima初學者...我不知道如何編輯主要編碼事情就像你提到this.target = $(目標); ..到Document.id ...請幫助我也是.. 。? 此外,Calender即時通訊使用的是具有獲取日期作爲鏈接,將當前日期傳遞到處理數據的新頁面根據傳遞的數據...我搜索了很多壓光機爲此,並在最後我發現這個日曆...現在重新開始將會像地獄....請幫助我這個... 謝謝你... – Akjethwani 2012-01-05 14:43:35