Skip to content Skip to sidebar Skip to footer

Adding Html To Jquery Isotope Additems/insertitems

I wish to add html to this function, I have this so far which is basically a grid of thumbnail images which act as a control for a carousel or corresponding images:

Solution 2:

Try this code (untested, but should be close to right):

functionmakeDataSlide(slideId, imgSrc, slideTitle) {
  var slide = $('<li data-target="#myCarousel" data-slide-to="'+ slideId +'"></li>');
  var gridItem = $('<div class="grid-item" style="display:none"></div>');
  $(gridItem).append('<img src="'+ imgSrc +'">');
  $(gridItem).append('<h4>'+ slideTitle +'</h4>');
  $(slide).append(gridItem);
  return slide;
}

$('.button').on( 'click', function() {
    var $items = [
      makeDataSlide(8, 'img/btn.png', 'The lemon tree-short film'),
      makeDataSlide(9, 'img/btn.png', 'The lemon tree-short film'),
      makeDataSlide(10, 'img/btn.png', 'The lemon tree-short film'),
      makeDataSlide(11, 'img/btn.png', 'The lemon tree-short film'),
    ]
    $grid.isotope( 'insert', $items);
});

If you continue to have trouble, please consider accepting the previous answer for mutli-line strings and opening a new question as we have moved quite far from the original scope of this question.

Post a Comment for "Adding Html To Jquery Isotope Additems/insertitems"