开发者

cycle next and previous based on position function?

开发者 https://www.devze.com 2023-01-05 07:17 出处:网络
i know how to call prev/next normally but i want it to open the next slide if the mouse is over half way of the screen and previous if less then half way over.

i know how to call prev/next normally but i want it to open the next slide if the mouse is over half way of the screen and previous if less then half way over.

can't seem to find $.cycle.next() or similar. Any ideas welcome...!

ie

$('div.pageImages').cycle({
        height  :   '600px',
        width   :   '600px',
        timeout :   0,
        speed   :   400,
        before  :   onBefore,
        after   :   onAfter

    });  

$('div.pageImages img').bind('click',function(e)开发者_开发知识库{
    var ww = $(window).width();
    if(!$(this).attr('href')) $()(e.pageX < (ww/2) ? **CYCLE_PREVIOUS** : **CYCLE_NEXT**);
    alert(e.pageX);

});


ok - this worked! need v2.88 of cycle

$('#pageImages').cycle({
            height  :   '600px',
            width   :   '600px',
/*          next    :   'div.pageImages', */
            timeout :   0,
            speed   :   400,
            before  :   onBefore,
            after   :   onAfter

        });

        $('div.pageImages img').bind('click',function(e){
            var ww = $(window).width();
            if(!$(this).attr('href')) $(e.pageX < (ww/2) ? $('#pageImages').cycle('prev') : $('#pageImages').cycle('next'));
        });
0

精彩评论

暂无评论...
验证码 换一张
取 消