window.addEventListener("updatedHeight", (event) => {
let old = event.detail.height;
alert(old);
let newHeight = $(".chatbox_body")[0].scrollHeight;
alert(newHeight);
let height = $(".chatbox_body").scrollTop(newHeight - old);
alert(height);
window.livewire.emit("updateHeight", {
height: height,
});
alert(height);
});
我尝试让height返回一个值,但它返回的却是一个对象
1条答案
按热度按时间u1ehiz5o1#
根据MDN docs,
.scrollTop()
用于获取值,.scrollTop(value)
用于设置值而不返回值。你可以改变:致: