简体   繁体   中英

Place corner stamp in top left corner in Masonry?

I had been just including my corner stamp as the first item, but I now have a need to prepend new items on the fly rather than append them. This causes the corner stamp to be pushed down as items are added.

Does anyone know of a work around for this?

Instead of prepending to parent div you can try after on the corner stamp.

$('.corner-stamp').after('<div>newElement</div>');

If you have cases without corner stamp also.

if($('.corner-stamp').length){
  $('.corner-stamp').after('<div>newElement</div>');
  $('#container').masonry( 'reload' );
  } 
else{
  $('#container').prepend('<div>newElement</div>').masonry( 'reload' );
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM