2011-01-13 39 views
0

直播提示我有提示的工作版本(jQuery的工具 - http://flowplayer.org/tools/demos/tooltip/index.html),jQuery的工具 - 阿賈克斯

jQuery(document).ready(function() { 
jQuery('.more_info').each(function(){ 
    jQuery(this).tooltip({ 
     effect: 'slide', 
     offset: [10, 570], 
     predelay: 100, 
     position: "bottom left"}).dynamic({ 
     bottom: { 
     direction: 'down', 
     bounce: true 
    } 
    }); 
}); 

});

AJAX加載後,提示不工作了,因爲,劇本已經被加載,我試圖從論壇http://flowplayer.org/tools/forum/30/37281解決方案,但沒有工作,或者未正確執行

這裏是代碼:

jQuery(document).ready(function() { 
jQuery('.more_info').each(function(){ 
    jQuery(this).not('.tt_init').tooltip({ 
     effect: 'slide', 
     offset: [10, 570], 
     predelay: 100, 
     position: "bottom left"}).dynamic({ 
     bottom: { 
     direction: 'down', 
     bounce: true 
     } 
    }); 
    jQuery(this).not('.tt_init').addClass('tt_init'); 
}); 

});

並沒有什麼......我做錯了,謝謝你的幫助),對不起我的英語不好

+0

你並不需要jQuery插件的`each`。這是矯枉過正。 – 2011-01-13 16:07:08

+0

我是jquery的新手,如果它是鼠標懸停,那麼更好的方法是什麼 – mIRU 2011-01-13 16:21:42

回答

2

如果問題是動態的內容,你可以嘗試使用jQuery的live API。

jQuery('.more_info').live('mouseover', function(){ 
    // may need to check here if it already has a tooltip (depending on plugin) 
    jQuery(this).tooltip({ 
     effect: 'slide', 
     offset: [10, 570], 
     predelay: 100, 
     position: "bottom left"}).dynamic({ 
      bottom: { 
      direction: 'down', 
      bounce: true 
     } 
    }); 
}); 

另一種解決方案是手動激活ajax內容的工具提示。例如:

$('#result').load('ajax/test.html', function() { 
    $(this).find('.more_info').tooltip({*/...*/}); 
}); 

或者您可以使用global responders對所有ajax請求執行此操作。