我在定位div
. 这是div
:
<div class="facebookHoverDiv" style="position: absolute; top: 0; left: 0; z-index: 15000; display: none">
<div class="calendar-hover-top"></div>
<div class="calendar-hover-middle">
<div class="post-image"></div>
<div class="facebook-icon">Facebook</div>
<div class="post-content"><span id="facebook-text">content</span>
<div class="post-date">This will be the date.</div>
</div>
</div>
<div class="calendar-hover-bottom"></div>
</div>
<div class="twitterHoverDiv" style="position: absolute; top: 0; left: 0; z-index: 15000; display: none">
<div class="calendar-hover-top"></div>
<div class="calendar-hover-middle">
<div class="twitter-icon">Twitter</div>
<div class="post-content"><span id="twitter-text">content</span>
<div class="post-date">This will be the date.</div>
</div>
</div>
<div class="calendar-hover-bottom"></div>
</div>
我正在使用以下 jQuery 函数来显示工具提示:
function ShowToolTip(event, postType, postMessage, scheduleDate, customPostId, postId) {
if (postType == 'Twitter') {
$('.twitterHoverDiv .post-content #twitter-text').text(postMessage);
$('.twitterHoverDiv .post-content .post-date').text(scheduleDate);
$('.twitterHoverDiv').css("left", event.x - 65);
$('.twitterHoverDiv').css("top", event.y - $('.twitterHoverDiv').height());
$('.facebookHoverDiv').hide();
$('.twitterHoverDiv').show();
} else {
$('.facebookHoverDiv .post-content #facebook-text').text(postMessage);
var url = "http://host.mmm.dev.webedge.mcmurry.com/Media/Image.ashx?articleid=" + postId + "&custompostid=" + customPostId;
//url = url.replace("undefined", "0");
$('.facebookHoverDiv .post-image').css("background-image", "url('" + url + "')");
$('.facebookHoverDiv .post-image').css("background-size", "100%");
$('.facebookHoverDiv .post-content .post-date').text(scheduleDate);
$('.facebookHoverDiv').css("left", event.x - 65);
$('.facebookHoverDiv').css("top", event.y - $('.facebookHoverDiv').height());
$('.twitterHoverDiv').hide();
$('.facebookHoverDiv').show();
}
}
如果我在 Google Chrome 中运行它,它会完美运行。但是,如果我在 FireFox 中运行它,工具提示会显示在屏幕的左上角。问题似乎出$('.facebookHoverDiv').css("left", event.x - 65);
在$('.facebookHoverDiv').css("top", event.y - $('.facebookHoverDiv').height());
电话中。
我需要为 FireFox 做一些特定的事情吗?