我有這個基本的功能,應該在頁面加載時運行,但它似乎沒有被調用,我知道這個函數是正確的,因爲它使用$('window').resize
(document).ready(function()is not running the function
的功能是和在頁的端部正在被呼叫時完美地運行,隨後僅由$(window).resize
版本的功能和</body>
的;
<script>
$(document).ready(function() {
var sliderImgH = $(".sliderimages").height();
$(".buttonmove:nth-child(1)").css("margin-top", sliderImgH-75);
});
</script>
'$(「。sliderimages」)'返回一個集合或單個元素嗎?什麼'$(「。sliderimages」)。height();'return? – guest271314
@ guest271314它爲我的滑塊中的多個元素,它返回圖像的高度 –
如果它返回多個元素,不應該使用'each()'然後? – Machavity