繁体   English   中英

向下滚动页面时,网页卡在jQuery滑块上

[英]web page gets stuck on jquery slider when scrolling down page

我的主页中间有一个滑块。 我使用鼠标滚轮和触控板将页面向下移动,直到到达本节时,滚动停止并开始在滑块中滚动。 如何删除此div的鼠标滚轮/触控板功能,以便可以轻松地向下滚动整个页面?

滑块如下所示:

<div class="content_slider_wrapper" id="slider1"></div>

$(document).ready(function() {



                   var image_array = new Array();
                   image_array = [
                   {image: ‘myimage.jpg',
                   main_link: '', main_link_target: 0,
                   upper_text_label_show: 0, upper_text_label: '', upper_text_label_style: '',
                   lower_text_label_show: 1, lower_text_label: ‘My Item’, lower_text_label_style: 'color: black; font-family: Arial;'},

                   ];
                   $('#slider1').content_slider({   // bind plugin to div id="slider1"
                                                map : image_array,      // pointer to the image map
                                                middle_click: 3,
                                                max_shown_items: 7,     // number of visible circles
                                                hv_switch: 0,           // 0 = horizontal slider, 1 = vertical
                                                active_item: 1,         // layer that will be shown at start, 0=first, 1=second...
                                                wrapper_text_max_height: 110,   // height of widget, displayed in pixels
                                                small_pic_height: 160,
                                                small_pic_width: 160,
                                                child_div_width: 180,
                                                child_div_height: 180,
                                                big_pic_width: 462,
                                                big_pic_height: 462,
                                                hide_prettyPhoto: 1,
                                                hide_arrows: 1,
                                                middle_click: 3,        // when main circle is clicked:
                                                auto_play: 1,
                                                enable_scroll_with_touchmove_on_horizontal_version: 0,
                                                enable_scroll_with_touchmove_on_vertical_version: 0,
                                                // 1 = slider will go to the previous circle, 2 = to the next,
                                                // 3 = open 'main_link', 0 = nowhere (no response)
                                                border_radius: 5,       // -1 = circle, 0 and other = radius
                                                border_on_off: 0,
                                                mode: 2,
                                                });




                   });

我尝试了以下方法,但它们没有起作用:

$(window).unbind('scroll');

$('#slider1').bind('mousewheel DOMMouseScroll', function(e) {
                                  var scrollTo = null;

                                  if (e.type == 'mousewheel') {
                                  scrollTo = (e.originalEvent.wheelDelta * -1);
                                  }
                                  else if (e.type == 'DOMMouseScroll') {
                                  scrollTo = 40 * e.originalEvent.detail;
                                  }

                                  if (scrollTo) {
                                  e.preventDefault();
                                  $(this).scrollTop(scrollTo + $(this).scrollTop());
                                  }
                                  });

将滑块的enable_mousewheel属性设置为0怎么样?

从其文档中:

1表示当鼠标指针在滑块上方时,鼠标滚轮将滑动滑块。 如果要禁用此功能,请将其设置为0。

内容滑块插件文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM