2010-04-08 128 views
-1

我想爲我的wordpress創建tooltip sample它工作的很好,但只要我將它集成到wordpress中,我無法獲取工具提示。我想工作的頁面是hereJqueryTools衝突

好的我做了一個小實驗,這是test version,這是wordpress version。測試版本是您查看源代碼時的代碼,將其全部保存並上傳,工具提示工作正常!但WordPress的版本不起作用..現在,這是相同的,但一個正在工作,另一個不是。

這裏是JQuery的代碼:

部首

<script src="http://cdn.jquerytools.org/1.1.2/full/jquery.tools.min.js" type="text/javascript"/></script> 
<script type="text/javascript"> 
var $ = jQuery.noConflict(); 
</script> 

頁腳

<script> 
// What is $(document).ready ? See: http://flowplayer.org/tools/using.html#document_ready 

$(document).ready(function() { 

    // enable tooltip for "download" element. use the "slide" effect 
    $("#download_now").tooltip({ effect: 'slide'}); 
}); 
</script> 

,這是WordPress的產生什麼(這是從一個視圖源)

<script src="http://cdn.jquerytools.org/1.1.2/full/jquery.tools.min.js" type="text/javascript"/></script> 
    <script type='text/javascript' src='http://www.testground.idghosting.com/philcom/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script> 
<script type="text/javascript"> 
var $ = jQuery.noConflict(); 
</script> 

    <script type='text/javascript'> 
      $j=jQuery.noConflict(); 


      $j(document).ready(function() { 
       initCalendar(); 
      }); 

      function initCalendar() { 
       $j('a.prev-month').click(function(e){ 
        e.preventDefault(); 
        tableDiv = $j(this).parents('table').parent(); 
        ($j(this).hasClass('full-link')) ? fullcalendar = 1 : fullcalendar = 0; 
        prevMonthCalendar(tableDiv, fullcalendar); 
       }); 
       $j('a.next-month').click(function(e){ 
        e.preventDefault(); 
        tableDiv = $j(this).parents('table').parent(); 
        ($j(this).hasClass('full-link')) ? fullcalendar = 1 : fullcalendar = 0;  
        nextMonthCalendar(tableDiv, fullcalendar); 
       }); 
      }  
      function prevMonthCalendar(tableDiv, fullcalendar) { 
       if (fullcalendar === undefined) { 
        fullcalendar = 0; 
        } 
       month_n = tableDiv.children('div.month_n').html();         
       year_n = tableDiv.children('div.year_n').html(); 
       parseInt(month_n) == 1 ? prevMonth = 12 : prevMonth = parseInt(month_n,10) - 1 ; 
       if (parseInt(month_n,10) == 1) 
         year_n = parseInt(year_n,10) -1; 
       $j.get("http://www.testground.idghosting.com/philcom", {ajaxCalendar: 'true', calmonth: prevMonth, calyear: year_n, full: fullcalendar}, function(data){ 
        tableDiv.html(data); 
        initCalendar(); 
       }); 
      } 
      function nextMonthCalendar(tableDiv, fullcalendar) { 
       if (fullcalendar === undefined) { 
        fullcalendar = 0; 
        } 
       month_n = tableDiv.children('div.month_n').html();         
       year_n = tableDiv.children('div.year_n').html(); 
       parseInt(month_n,10) == 12 ? nextMonth = 1 : nextMonth = parseInt(month_n,10) + 1 ; 
       if (parseInt(month_n,10) == 12) 
         year_n = parseInt(year_n,10) + 1; 
       $j.get("http://www.testground.idghosting.com/philcom", {ajaxCalendar: 'true', calmonth: nextMonth, calyear: year_n, full : fullcalendar}, function(data){ 
        tableDiv.html(data); 
        initCalendar(); 
       }); 
      } 

      // function reloadCalendar(e) { 
      // // e.preventDefault(); 
      //  console.log($j(this).parents('table')); 
      //  $j.get("http://www.testground.idghosting.com/philcom", {ajax: 'true'}, function(data){ 
      //  tableDiv = table.parent(); 
      //  tableDiv.html(data); 
      //    }); 
      // } 
      //      

     </script> 

回答

0

我只用HTML編輯器,我寫我自己的<p>標籤和<br />等等......我遇到的問題是,每次我用一種特殊的<span>定製的造型,我」 WP在該段後面增加了一個<p>以及該段後面的<br />

現在的解決辦法是讓格式化的WordPress的編輯器由downloading this plugin

0

我想你使用$而不是$ j?

<script> 
// What is $(document).ready ? See: http://flowplayer.org/tools/using.html#document_ready 

$(document).ready(function() { 
// enable tooltip for "download" element. use the "slide" effect 
$("#download_now").tooltip({ effect: 'slide'}); 
}); 
</script> 
+0

我在哪裏可以把在禁用?這有點不同於$ j = jQuery.noConflict(); – 2010-04-08 16:11:31

+0

增加了一個$ j仍然不顯示 – 2010-04-08 16:17:58

+0

$ j(「#download_now」)。tooltip({effect:'slide'});需要$(「#download_now」)。tooltip({effect:'slide'}); – 2010-04-08 16:22:19