<?php
/**
 * Shortcode attributes
 * @var $atts
 * @var $number
 * @var $text
 */

if( !function_exists('yolo_shortcode_image_slider') ){
  function yolo_shortcode_image_slider($atts, $content){
    extract(shortcode_atts(array(
      'values'         => '',
      ), $atts ) );
    ob_start();
    wp_enqueue_script('yolo-carousel-slide');
    wp_enqueue_style('yolo-carousel-slide');
    $values = (array) vc_param_group_parse_atts( $values );
?>

  <div class="images-slider">
    <div class="my-flipster carousel">
         <?php if( $values ) : ?>
                    <ul class="carousel-wrapper">
                    <?php foreach ($values as $value) : ?>
                        <li class="carousel-box">
                          <?php echo wp_get_attachment_image($value['value'],$size='full'); ?>
                            <p><?php echo $value['label']; ?></p>
                        </li>
                    <?php endforeach; ?>
                    </ul>
                <?php endif; ?>
    </div>
  </div>  
   <script>
window.onload = function() {
    Carousel.init({
            target: jQuery('.carousel')
        });
};
   </script>
    <?php
    $about_us = ob_get_contents();
    ob_end_clean();
    return $about_us;
  }
  add_shortcode('yolo_image_slider','yolo_shortcode_image_slider');
}
?>