$(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);
代言2017-07-05 11:08:33
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()