Alex Florea Alex Florea - 10 days ago 7
jQuery Question

Add link to image in the flexslider

I'm using the flexslider plugin and i wanted to know if there is an easy way (apart from changing the core of the plugin which is what i am going to do if i don't find an easy answer)
to go to link when i click on the current slide image. I set up the flexslider simply like this:

$('#slide-top').flexslider({
animation: 'slide'
});


and in the view:

<div id="slide-top" class="flexslider">
<ul class="slides">
<?php foreach ($gallery_top_slide as $image_slide): ?>
<li><img src="<?=base_url();?>assets/uploads/top_slide/<?=$image_slide['photo_url']?>" /></li>
<a href="<?=$image_slide['link_url']?>">Not need text on image</a>
<?php endforeach; ?>
</ul>
</div>


How can i do this?

For ex. if i click on current image go to www.google.com

Thanks in advance !

Answer

Try this.

            <ul class="slides">
                <?php foreach ($gallery_top_slide as $image_slide): ?>
                        <li>
                           <a href="<?=$image_slide['link_url']?>">
                              <img src="<?=base_url();?>assets/uploads/top_slide/<?=$image_slide['photo_url']?>" />
                           </a>
                        </li>
                <?php endforeach; ?>
            </ul>