イメージファイルのオリジナルサイズを確認する
.naturalHeight
.naturalWidth
function item_cards_event(){
var x = document.getElementsByClassName('item_cards');
for(var i = 0; i<x.length; i++){
x[i].addEventListener("mouseover",function(e){
this.style.boxShadow = "3px 3px 14px";
console.log(
this.firstElementChild.nextElementSibling.firstElementChild.naturalWidth + 'x' + this.firstElementChild.nextElementSibling.firstElementChild.naturalHeight);
},false);
x[i].addEventListener("mouseout",function(e){
this.style.boxShadow = "1px 1px 1px";
},false);
}
}
item_cards_event();
例
function item_cards_event(){
var x = document.getElementsByClassName('thumbnail_a');
for(var i = 0; i<x.length; i++){
x[i].addEventListener("mouseover",function(e){
this.style.boxShadow = "3px 3px 14px";
console.log(this.firstElementChild.alt);
console.log(this.firstElementChild.naturalWidth + 'x' + this.firstElementChild.naturalHeight);
},false);
x[i].addEventListener("mouseout",function(e){
this.style.boxShadow = "1px 1px 1px";
},false);
}
}
item_cards_event();