badcrocodile
10/2/2014 - 4:37 PM

Very hacky way to make only select cycle2 slider images clickable

Very hacky way to make only select cycle2 slider images clickable

<!-- Slideshow -->
<div class="cycle-slideshow in-page-slider" data-cycle-fx="fade" data-cycle-pause-on-hover="true" data-cycle-timeout="3000" data-cycle-slides="> .slide-in-page" data-cycle-pager="#pager" data-cycle-pager-template="<a href='#' class='no-transition'></a>">

    <?php while(have_rows('slider')) : the_row(); ?>
        
        <div class="slide-in-page" style="background: url(<?php the_sub_field('image'); ?>) no-repeat center center <?php echo (get_sub_field('link') ? '; cursor: pointer;' : ''); ?>">
            <?php if(get_sub_field('link')) : ?>
                <a class="hide slider-link" href="<?php the_sub_field('link'); ?>" target="_blank"></a>
            <?php endif; ?>
            <?php if(get_sub_field('caption')) : ?>
                <div class="overlay">
                    <span class="slider-header"><?php the_sub_field('caption'); ?></span>
                </div>
            <?php endif; ?>
        </div>
        
        
    <?php endwhile; ?>

    <div class="cycle-pager" id="pager"></div>
          
                            </div>
function sliderLink() {
    $(".slide-in-page").click(function(){
        window.location=$(this).find("a").attr("href"); 
        return false;
    });
}