0
我试图在使用.show()
函数显示元素之前更改.right-content
的高度。我希望新的高度等于通过t .html()
转换的加载的PHP页面的高度。如何在显示元素之前从.load()获取新高度
在调用.show()
函数之前,我一直无法找到这个高度的方法,因此当页面加载时,它有时会被切断或变大(因为某些页面比较大/较小,其他)。
有没有办法获取高度并将其更改为注释在代码中的位置?谢谢!!
$(document).ready(function() {
jQuery.easing.def = "easeInOutBack";
$(".right-content")
.hide("slide")
.load("homePage/start.php").html();
$(".right-content")
.show("slide", {direction: "left"}, 750);
$('#footer')
.fadeIn(2000);
$(".button").click(function() {
$(".right-content").hide("slide", {direction: "left"}, 700, function() {
$(this).load("homePage/" + item + ".php", function() {
// figure out how to get the new .load() height and set $(this).height() equal to it
console.log($(this).height());
});
$(this).show("slide", {direction: "left"}, 1000);
});
});
});
为了获得高度,它需要在页面上呈现。您可以将其粘贴在页面外的某个元素中并读取该值。 – epascarello