javascript - The height of the image can be obtained in jQuery but the width cannot be obtained
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-07-05 11:06:33
0
1
885

$(document).ready(function() {

ko.validation.init({ errorElementClass: 'has-error', insertMessages : true }); ko.validation.registerExtenders(); var dataUrl = { imgUrl : '/api/advertise/advertisepost' }, loopPictures = $(".loopPictures"), buttons = $(".buttons"), imgYS = loopPictures.find("img"), imgWidth = imgYS.css("width"), imgHeight = imgYS.css("height"), kick = buttons.find("span"); console.log(imgWidth); console.log(imgHeight);
女神的闺蜜爱上我
女神的闺蜜爱上我

reply all (1)
代言

You are getting the style height. If you have not set it in CSS, it will definitely not exist. You can use document.getElementsByClassName("class")[0].offsetHeight to get it,
or directly use jquery $(".class") .height()

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!