jquery循环 - 悬停事件,单击应加载url

时间:2012-09-06 00:15:17

标签: jquery jquery-plugins jquery-cycle

我已经设置了一个带有jquery循环的幻灯片,并且在导航中我正在使用mouseover事件而不是click,这很正常。唯一的问题是我希望用户能够单击链接并单击以正常运行并加载URL。目前,点击没有任何反应。这是我的代码:

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

1 个答案:

答案 0 :(得分:1)

您可以为锚执行单独的JQuery事件,与'cycle'分开。

类似的东西:

$('#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.
);