0
以下代碼是在懸停時生成工具提示...將鼠標懸停在某些文本上,並使用以下代碼jQuery/Ajax - IE不抓取外部文件中的數據?
span class="ttip" rel="#tip_1"
然後它從外部文件(tooltips.html)中提取帶有tip_1的id的div。麻煩是在IE 7 & 8 - 它只是加載工具提示框 - 不是內部的內容...(就像它不能與tooltips.html文件溝通)
任何想法請嗎?
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.ttip').hover(function(){
var offset = jQuery(this).offset();
console.log(offset)
var width = jQuery(this).outerWidth();
var tooltipId = jQuery(this).attr("rel");
jQuery('#tooltip-cont').empty().load('/tooltips.html ' + tooltipId).fadeIn(500);
jQuery('#tooltip-cont').css({ top:offset.top, left:offset.left + width + 10 }).show();
}, function(){
jQuery('#tooltip-cont').stop(true, true).fadeOut(200);
});
});
</script>
代碼似乎很好 – mgraph 2012-02-07 12:15:38
我的想法完全是這樣的,在實際的toltips.html文件中似乎有些東西(可能是dodgey的字符),因爲有些工具提示工作不行 – CodeyMonkey 2012-02-07 12:34:21
嘗試刪除'fadeOut'和' fadeIn'然後測試 – mgraph 2012-02-07 12:38:10