SUN SUN - 4 months ago 18
jQuery Question

Jquery Mousehover to Mouse click

I have jquery code for image slideshow with tabs navigation. It is working & slides image on mouseHover of nav. I want it to work on Click of particular nav & show it's image

Working Demo - www.myevio.com

<script type='text/javascript'>//<![CDATA[
$(window).load(function () {
$(function () {
$('.fadein img:gt(0)').hide();
setInterval(function () {
$('.fadein :first-child').fadeOut().next('img').fadeIn().end().appendTo('.fadein');
}, 5000);
$('.banner-links-inner a').on({
'mouseenter': function () {
$('.fadein img').hide();
$('#' + $(this).data('id')).fadeIn();
}
});
});
});//]]>
</script>


How do I make it work on Click instead of hover?

Answer

Tryed with this?

 $('.banner-links-inner a').click(function () {
                        $('.fadein img').hide();
                        $('#' + $(this).data('id')).fadeIn();
                    });

instead using on?

or if you want to use on change to this:

$('.banner-links-inner a').on({
                    'click': function () {
                        $('.fadein img').hide();
                        $('#' + $(this).data('id')).fadeIn();
                    }
                });