javascript - If picture width is smaller than transparent box content start new line -


example

$('.img-rate').each(function(){     $(document).ready(function(){          var n = $(".img-rate").width;          if (n < 100) {             $('img-rate').hasclass('pull-leftt ')         }          else {             $("img-rate").css("background", "orange");         }     }); }); 

i think $('.img-rate') parent class of both image container, if not change line , use parent class instead,

second change wrap $('.img-rate').each(function(){}) code in $(document).ready.

and final change instead $('img-rate').hasclass('pull-leftt ') use $('img-rate').addclass('pull-leftt ');

let me know if work you.


Comments

Popular posts from this blog

javascript - How do you prevent nested queries/catches in sequelize? -

java - Could not retrieve pre-bound Hibernate session - Could not obtain transaction-synchronized Session for current thread -

ruby on rails - ActiveRecord order not working -