bsod99
bsod99

Reputation: 1297

jquery cycle - hover event, click should load url

I've set up a slideshow with jquery cycle, and in the navigation i'm using the mouseover event instead of click, which is working fine. The only thing is that I want the user to be able to click the link and the click to behave as normal and load the url. At the moment, nothing happens on click. Here's my code:

$('#carousel').cycle({
        pager:      '.circle a', 
            pagerEvent: 'mouseover',
            pagerAnchorBuilder: function(idx, slide) { 
                // return selector string for existing anchor 
                return '.circle:eq(' + idx + ') a'; 
            } 
    });

Upvotes: 1

Views: 952

Answers (1)

fred2
fred2

Reputation: 1110

You can do a separate JQuery event for the anchor, separate from 'cycle'.

SOmething like:

$('#carousel').cycle({
    pager:      '.circle a', 
        pagerEvent: 'mouseover',
        pagerAnchorBuilder: function(idx, slide) { 
            // return selector string for existing anchor 
            return '.circle:eq(' + idx + ') a'; 
        } 
});


//assuming you use 'a' for anchors
$('.circle a').on('click', function(){
     //do your click event stuff.
);

Upvotes: 1

Related Questions