<?php

$args = array(
    "tz_slide_type" => "1",
    "tz_slide_auto_option" => "",
    "tz_slide_nav_option" => "",
    "tz_slide_dots_option" => "",
    "tz_slide_css_animation" => "",
    "tz_scroll_explore" => "1",
    "tz_text_scroll" => "",
    "tz_id_scroll" => "",
);

$html = "";

extract(shortcode_atts($args, $atts));
if ($tz_slide_type == '1'):
    wp_enqueue_style('owl.carousel');
    wp_enqueue_script('owl.carousel');
    $tz_type_slide = 'tz_type_slide1';
elseif ($tz_slide_type == '2'):
    wp_enqueue_style('owl.carousel2');
    wp_enqueue_script('owl.carousel2');
    $tz_type_slide = 'tz_type_slide2';
endif;



$interiart_slideid = rand(0, 10000);

?>
<div class="tzElement_slide_view <?php echo esc_attr($tz_type_slide); ?>">
    <div class="tzView_slide">
        <?php
        echo do_shortcode($content);
        ?>
    </div>
    <?php if ($tz_slide_type == '2' && $tz_scroll_explore == '1'): ?>
        <div class="tz_btn_scroll">

            <a class="tz_btn_click" id="tz_click_scroll" href="#<?php echo esc_attr($tz_id_scroll); ?>" title="">
                <?php if ($tz_text_scroll != ''): ?>
                    <span><?php echo esc_attr($tz_text_scroll); ?></span>
                <?php endif; ?>
                <i class="flaticon-down-arrow"></i>
            </a>

        </div>
    <?php endif; ?>
</div>
<div class="clr"></div>
<?php if ($tz_slide_type == '1'): ?>
    <script type="text/javascript">
        jQuery(document).ready(function () {
            "use strict";

            // Blog slider  -----------------
            jQuery(".tzView_slide").tzinteriart_owlCarousel({
                items: 1,
                itemsDesktop: 1,
                itemsDesktopSmall: 1,
                itemsTablet: 1,
                itemsMobile: 1,
                slideSpeed: 500,
                // paginationSpeed:500,
                // rewindSpeed:500,
                autoPlay:<?php if ($tz_slide_auto_option == true) {
                    echo 'true';
                } else {
                    echo 'false';
                }?>,
                stopOnHover: true,
                // singleItem:false,
                // addClassActive : true,
                navigation: <?php if ($tz_slide_nav_option == true) {
                    echo 'true';
                } else {
                    echo 'false';
                }?>,
                navigationText: ["<i class='flaticon-left-arrow'></i>", "<i class='flaticon-right-arrow'></i>"],
                pagination:<?php if ($tz_slide_dots_option == true) {
                    echo 'true';
                } else {
                    echo 'false';
                }?>,
                rewindNav: true,
                paginationNumbers: true,
                // itemsScaleUp:false,
                transitionStyle: "fade",
                // mouseDrag:true,

            });
        });
    </script>
<?php elseif ($tz_slide_type == '2'): ?>
    <script type="text/javascript">
        jQuery(document).ready(function () {
            "use strict";

            // Blog slider  -----------------
            jQuery(".tzView_slide").tzinteriart_owlCarousel({
                items: 1,
                itemsDesktop: 1,
                itemsDesktopSmall: 1,
                itemsTablet: 1,
                itemsMobile: 1,
                slideSpeed: 500,
                // paginationSpeed:500,
                // rewindSpeed:500,
                autoPlay: <?php if ($tz_slide_auto_option == true) {
                    echo 'true';
                } else {
                    echo 'false';
                }?>,
                stopOnHover: true,
                // singleItem:false,
                // addClassActive : true,
                navigation: <?php if ($tz_slide_nav_option == true) {
                    echo 'true';
                } else {
                    echo 'false';
                }?>,
                navigationText: ["<i class='flaticon-left-arrow'></i>", "<i class='flaticon-right-arrow'></i>"],
                pagination:<?php if ($tz_slide_dots_option == true) {
                    echo 'true';
                } else {
                    echo 'false';
                }?>,
                rewindNav: true,
                paginationNumbers: true,
                // itemsScaleUp:false,
                transitionStyle: "fade",
                // mouseDrag:true,

            });
        });

        $(document).ready(function(){
            // Add smooth scrolling to all links
            $("a").on('click', function(event) {

                // Make sure this.hash has a value before overriding default behavior
                if (this.hash !== "") {
                    // Prevent default anchor click behavior
                    event.preventDefault();

                    // Store hash
                    var hash = this.hash;

                    // Using jQuery's animate() method to add smooth page scroll
                    // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
                    $('html, body').animate({
                        scrollTop: $(hash).offset().top
                    }, 1000, function(){

                        // Add hash (#) to URL when done scrolling (default click behavior)
                        window.location.hash = hash;
                    });
                } // End if
            });
        });
    </script>

<?php endif; ?>
