jQuery JCarousel不是lite和鼠标滚轮需要帮助

问题描述

| 我在下面使用这些js文件:
jquery-1.4.2.min.js
include/jcarousel/lib/jquery.jcarousel.min.js
include/mousewheel/jquery.mousewheel.js
在我的index.php文件中,我得到了:
 jQuery(document).ready(function() {
jQuery(\'#mycarousel\').mousewheel(function(event,delta) {
                    if (delta > 0)
                    {carousel.prev();}
                    else if (delta < 0)
                    {carousel.next();}
        });
jQuery(\'#mycarousel\').jcarousel({

    size: mycarousel_itemList.length,itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback},visible: 3,btnNext: null,btnPrev: null,});

});
我相信问题出在
{carousel.prev();}
{carousel.next();}
我想将鼠标滚轮添加到我的jcarousel中,但是我在滚动滚轮时找不到要调用的适当函数。 请帮我。可能需要更多信息。直到现在我还是自己做。 :(     

解决方法

carousel.prev();和carousel.next();将无法使用,因为轮播尚未定义。您需要指定一个回调函数,然后可以在其中手动运行轮播函数。 例如:
jQuery(\'#mycarousel\').jcarousel({    
    size: mycarousel_itemList.length,itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback},visible: 3,btnNext: null,btnPrev: null,// The callback function to run
    initCallback: mycarousel_initCallback,});

function mycarousel_initCallback(carousel) {
    // All code referencing the carousel in here.
    jQuery(\'#mycarousel\').mousewheel(function(event,delta) {
        if (delta > 0)
            {carousel.prev();}
        else if (delta < 0)
            {carousel.next();}
        });

}
在此示例中了解更多信息:http://sorgalla.com/projects/jcarousel/examples/static_controls.html 希望这可以帮助!     ,在您的jquery.jcarousel.js中插入我的代码段 在这行之后: $(window).bind(\'load.jcarousel \',function(){windowLoaded = true;});
// Activate the mouse wheel function --------------------------
$(\'.jcarousel\').bind(\'mousewheel\',function(event,delta) {
    if (delta > 0)
        self.prev();
    else if (delta < 0)
        self.next();
});
    

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...