jeudi 26 février 2015

.clone not cloning the dimension of image properly using paperclip

I have an array of elements which are being displayed with their repective images using thumbnail defined through paperclip. When the data is replicated through .clone method of jquery everything is fine but the image does not show as per the thumb.Instead it shows the original size.



var clone = $('.pick.cloner').clone().appendTo('.picks-wrap .inner');
$(clone).data('id', data.picks[pick][1]);
$(clone).find('strong').html("Pick " + data.picks[pick][2]);
$(clone).find('p').html(data.picks[pick][3]);
$(clone).find('img').attr('src', data.picks[pick][4]);
$(clone).addClass('entering').removeClass('cloner');


My html



.inner
.pick.cloner
%em.selecting
Selecting
%em.ondeck
On Deck
%strong
Pick #
= image_tag("default_small_logo.jpg")
%p
Team Name

- @league.draft.get_picks(12).each_with_index do |pick, index|
.pick{ :class => "#{'selecting' if index == 0 && @league.draft.running?}#{'ondeck' if (index == 1 && @league.draft.running?) || (index == 0 && !@league.draft.running?)}"}
%em.selecting
Selecting
%em.ondeck
On Deck
%strong.img_go
= "Pick #{pick.pick_order}"
= image_tag(pick.team.logo.url(:draft))
%p
= pick.team.name


In firebug


Step 1: When the page is loaded or refreshed



<img alt="My image" src="http://ift.tt/1EuxjA8">


Step 2: When the clone is called the image source becomes like this



<img alt="My image" src="http://ift.tt/1wjk4v3">


How does it changes the thumbnail from "draft" to "original" I am not able to understand that neither am I able to debug the source of image that it is picking up or changing. It would be really great if someone helps.


Aucun commentaire:

Enregistrer un commentaire