0
所以在前面的問題中,我無法使用Jquery Mousemove功能在14列960網格系統中爲這些div提供這些工具提示。現在他們在某種程度上工作。他們只會跟隨我的鼠標喜歡第7或第8列(寬度)。如果您一直滾動到其他div的工具提示在某個點停止。不知道什麼是防止它一路下吧....這裏是鏈接到它的jsfiddle: http://jsfiddle.net/penrysh/eoL1qqf9/Jquery Tooltip mousemove event not follow mouse to all Divs
這裏是jQuery的:
$(document).ready(function(){
$('.tooltip').mouseover(function(e){
if($(this).attr('data-tip-type') == 'text'){
$('#tooltip_container').html($(this).attr('data-tip-source'));
} // this section grabs and shows the plain text tool-tip typles
if($(this).attr('data-tip-type') == 'html'){
var elementToGet = '#'+ $(this).attr('data-tip-source');
var newHTML = $(elementToGet).html();
$('#tooltip_container').html(newHTML);
} // this section grabs and shows the tool-tips that are HTML and can be formatted and are in divs at bottom on index page
}).mousemove(function(e){
var toolTipWidth = $('#tooltip_container').outerWidth();
var toolTipHeight = $('#tooltip_container').outerHeight();
var pageWidth = $('body').width();
if (e.pageX > pageWidth/2) {
$('#tooltip_container').css('left',(e,pageX-toolTipWidth+20)+'px'); // takes tooltip width and subtract from pageX position so it will always be offset from the cursor based on the tooltip itself
}else{
$('#tooltip_container').css('left',(e.pageX-20)+'px'); // Determines where courser is and subtracts 20pxs from it
}
$('#tooltip_container').css('top',(e.pageY+20)+'px'); // Determines where courser is and subtracts 20pxs from it
}).mouseout(function(e){
});
}); // end ready