(document).ready(function()is not running the function
我有这个基本的功能,应该在页面加载时运行,但它似乎没有被调用,我知道这个函数是正确的,因为它使用$('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
元件:first
$(document).ready(function() {
var sliderImgH = $(".sliderimages:first").height();
$(".buttonmove:nth-child(1)").css("margin-top", sliderImgH-75);
});
仍然不起作用,这里是链接到网站,我只是想移动滑块按钮,所以它是在滑块图像,http://optential.co.nf/ –
@MattHammond可以描述_“仍然无法工作”_? ,请在Question?链接中包含'html',创建stacksnippets,http://jsfiddle.net来演示? – guest271314
这似乎在这里工作有多奇怪 - https://jsfiddle.net/aL1jk855/ –
'$(“。sliderimages”)'返回一个集合或单个元素吗?什么'$(“。sliderimages”)。height();'return? – guest271314
@ guest271314它为我的滑块中的多个元素,它返回图像的高度 –
如果它返回多个元素,不应该使用'each()'然后? – Machavity