我想为每个以 obj_ 开头的 div 女巫类做点什么 例如:
<img class="obj_1" />
例如,我想将每张图片的大小调整为比例大小:
scale = 2
然后我想把图像的宽度和高度加倍。
我也想在左侧和顶部位置执行此操作。
图像将像这样加载:
<div id='obj' class="obj_84" style='top:1152px;left:6px;' onmousedown='return false;'><img src ="img/obj/0.png" /></div>
我该怎么做?
我希望你有足够的信息来解决我的问题。
谢谢
最佳答案
$('div[class^=obj_] img').each( function( ){
$(this).css({
width: $(this).width() * 2,
height: $(this).height() * 2
});
});
关于每个图像的 Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8701089/