Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add div on top of centered image?

I am using ImageFlow SEE i want to add div on Top of Image once images clicked and Slides into Center. I tried checking js file but MoveIT() function is called so many times in js and m not able to identify ,

t.wrap('<div class="f1_card"></div>');

when should i write to wrap div around image.

Thanks,

like image 922
KhAn SaAb Avatar asked May 22 '13 09:05

KhAn SaAb


1 Answers

You can use the prepend() function of jquery. You just need to select the image element and then call prepend function. See the example:

$('.target_image').prepend('<div class="f1_card"></div>');

This will be ok if you want to add an element if you want to add prior to an element. But if you want to wrap an element with a div then you have to use wrap() function.

$('.target_image').wrap('<div class="f1_card"></div>');

And obviously you have to put this code above within the click function or similar event you want. see the example:

$('.target_image').on('click', function(){
   $(this).prepend('<div class="f1_card"></div>');
});

Here div with class 'f1_card' will be the parent class of your target_image element. Hope this will help you.

like image 117
Md. Mahbubul Haque Avatar answered Sep 21 '22 21:09

Md. Mahbubul Haque