2012-09-14 65 views
0

在ajax成功後的活動元素下,cluetip的代碼不能用於第一次點擊,否則它可以順利運行。 第一次點擊會造成什麼問題?cluetip無法在ajax成功後首次點擊活動元素

$('a.load-local').live('click', function(event) { 
    $('a.load-local').cluetip({ 
     width: 'auto', 
     activation: 'click', 
     local:true, 
     sticky: true, 
     arrows: true, 
     positionBy:'bottomTop', 
     cursor: 'pointer', 
     closePosition: 'top', 
     closeText: '<img src="images/close1.jpg" alt="close" width="16" height="16"   
     style="position:absolute; right:5px; top:0px;" />' 
    }); 
    event.preventDefault(); 
    }); 

回答

0

我真的不知道cluetip,但有可能對點擊的元素第一次點擊的實際初始化cluetip,然後將它正常工作? (儘管每次點擊都會重新初始化它)

快速查看他們的演示頁面http://plugins.learningjquery.com/cluetip/demo/表明cluetip方法會初始化而不是調用。

0

在您的代碼中,cluetip每次單擊錨時都會初始化 - a.load-local。在我看來只需要下面的代碼,你可以添加在$('document').ready()

$('a.load-local').cluetip({ 
     width: 'auto', 
     activation: 'click', 
     local:true, 
     sticky: true, 
     arrows: true, 
     positionBy:'bottomTop', 
     cursor: 'pointer', 
     closePosition: 'top', 
     closeText: '<img src="images/close1.jpg" alt="close" width="16" height="16" 
     style="position:absolute; right:5px; top:0px;" />' 
    });