我得到了一個奇怪的問題與jQuery。 我必須刪除身體的最後一個孩子才能使調整大小功能正常工作。 最後一個孩子是由twitter-social-plugin插入的div,已過時。:最後一個孩子刪除身體div
在我調整大小功能我想
$('body:last-child').remove();
文檔的結構如下
<body>
<div>here comes content and stuff</div>
</div>that´s the div to be removed</div>
</body>
當調整大小功能被調用時,整個身體標記被刪除,我得到一個空白頁面。 調整大小功能:
$(document).ready(function() {
$(window).bind('resize', function() {
$('body:last-child').remove();
contentStretch();
function contentStretch() {
$('#content-stretch').css({
height: "0"
});
var page_height = $('#container').height();
var window_height = $(window).height();
var difference = window_height - page_height;
if (difference < 0) {
difference = 0;
};
$('#content-stretch').css({
height: difference + "px"
});
};
});
});
我們續給$(「最後一子體」)。孩子的身體標記是div,不需要你想要刪除的div – Gautam3164 2013-02-16 12:52:53