jquery - Increment image width by 50px -


i have image appears multiple times, need image width increment 50px each time appears.

i've tried accomplish jquery, i'm having no luck @ moment, ideas i'm going wrong?

the html loops through each bit of content is:

<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> 

and jquery have is:

var w = 50; var newwidth; // can tash $('.what-can-we-do-tash').each(function(){     newwidth === w;     $(this).attr('width',newwidth);     w+50; }); 

however doesn't seem doing :(

you should use .css():

$('.what-can-we-do-tash').css('width', function(i){     return $(this).width() + (i * 50); }); 

here working: http://jsfiddle.net/wdpvv/1/


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -