JengGe Chao
JengGe Chao

Reputation: 160

Jquery Display round tag image under image issue

I want to add round tag Images(25*25 pixel) on all Image tags in the html Dom. It works but with my code the position sometimes changes and it often displayed under the Image.

Here is my code:

jQuery("img").each(function() {
    var image = jQuery(this);
    if ((image.width() >= 512) && (image.width() <= 2048)){
        image.parent().css('display', 'inline-block');
        var top_pos = image.offset().top+200, left_pos = image.offset().left+150;                       
        image.parent().append('<div class="tag_image first_tag_image1" id="first_draggable1" style="position:absolute;'+'top:'+top_pos+'px;'+'left:'+left_pos+'px;">');
        //do something
    }
});

Anybody who knows what to do? If any question please add a comment.

Upvotes: 1

Views: 46

Answers (1)

user5683130
user5683130

Reputation:

You have to use :before. For example image.before('//some code')

Upvotes: 2

Related Questions