javascript - If picture width is smaller than transparent box content start new line -
$('.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
Post a Comment