$(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);
你这是 获取style 样式 height , 你在CSS 里面没有设置 就肯定没有的, 你可以用document.getElementsByClassName("class")[0].offsetHeight 获取,
或者直接用jquery $(".class").height()