facelordgists
4/3/2015 - 7:39 AM

Pull images out of a revolution slider and print them into a div

Pull images out of a revolution slider and print them into a div

jQuery(function($) {

  extract_images_from_rev_slider = function ( $new_container, $target_selector ) {
    
    $new_container = $new_container || 'flattened-slider';
    $target_selector = $target_selector || 'defaultimg';
    i = 1;
    $(".rev_slider_wrapper").each( function(index, value){
      var images = $(this).find('.'+$target_selector).map(function(){
        return $(this).attr('src')
      }).get()
      $( "<div class='"+ $new_container +"' id='"+$new_container+"-"+i+"'></div>" ).insertBefore(this);
      $.each(images, function(idx, image_url) {
        $( "<img class='"+ $new_container +"__img' src='"+image_url+"'>" ).appendTo( '#'+$new_container+'-'+i );
      });
      $(this).remove();
      i++;
    })
  };
	
  extract_images_from_rev_slider();
    
});