1
我看到顶部和底部位置之间的奇怪差异。 我已经把在一起的四个简单的例子来证明这个问题:jQuery顶部和底部位置的奇怪行为
//example 1
$('#box1').hover(function() {
var offset = $('#box1').offset();
$("#containment-wrapper1").css({
bottom: offset.top
});
});
//example 2
$('#box2').hover(function() {
var x = $('#box2').css('top');
$("#containment-wrapper2").css({
bottom: x
});
});
//example 3
$('#box3').hover(function() {
var x = $('#box3').css('top');
$("#containment-wrapper3").css({
top: x
});
});
//example 4
$('#box4').hover(function() {
var offset = $('#box4').offset();
$("#containment-wrapper4").css({
top: offset.top
});
});
实例3和4,像预期,上边框线与底部边框。
示例1和2不示例。似乎有大约30px的差异。
这是一个错误还是我错过了什么?
我想我现在明白了,谢谢你花时间为我拼出来。 – apaul