我有一個圖像出現多次,但我需要圖像寬度增量50px每次出現。增加圖像寬度50px
我試過用jQuery來完成這個任務,但是我現在沒有運氣,任何想法都會出錯。
是遍歷得到的內容每一位的HTML是:
<div class="hideme">
<h3 class="text-white"><?php the_sub_field('whatcanwedo_stats_number'); ?></h3>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/img/tash5.png" alt="tash5" class="what-can-we-do-tash" />
<p><?php the_sub_field('whatcanwedo_stats_content'); ?></p>
</div>
而jQuery的我已經是:
var w = 50;
var newWidth;
// what can we do tash
$('.what-can-we-do-tash').each(function(){
newWidth === w;
$(this).attr('width',newWidth);
w+50;
});
然而,這似乎並沒有被做任何事情:(