javascript - 当页面在移动站点中放大时, slider 停止移出屏幕

标签 javascript jquery css jquery-ui-touch-punch

我正在向我的网站添加一个 QapTcha 插件,我正在使用 jquery.ui.touch-punch.min.js。 但是,当我从移动站点放大页面并将 slider 向左拖动时,它会移出栏,这是不应该的。我附上了图片以了解发生了什么。

As you can see when the page is loaded the scroll bar that says "Scroll right" is situated perfectly in the bar and it doesnt move off it onto the left

When you swipe right it still works fine stays in the bar

the problem occurs when you zoom into the page and you swipe the scroll bar it moves left out of the page

当您放大页面并滑动滚动条时,就会出现问题,滚动条会向左移出页面,如您在第三张图片中所见。这是我的代码:

 Slider.draggable({

                containment: bgSlider,
                axis: 'x',
                stop: function (event, ui) {
                    if (ui.position.left > 123) {
                        Slider.draggable('disable').css('cursor', 'default');
                        inputQapTcha.val("");
                        TxtStatus.css({ color: '#307F1F' }).text(opts.txtUnlock);
                        Icons.css('background-position', '-16px 0');
                        //form.find('input[type=\'submit\']').removeAttr('disabled');
                        $(opts.buttonLock).removeAttr('disabled');
                        ///Show a fornm
                        if ($(opts.buttonLock).attr("show")) {
                            $($(opts.buttonLock).attr("show")).css("display", "block");
                            $("#QapTcha").fadeOut(500);
                        }
                        else if (opts.buttonLock == 'input[name="SendMail"]') {
                            $(opts.buttonLock).bind("click", function () {
                                AuroraJS.Modules.SendMail(this);
                            });
                        }
                        else if (opts.buttonFunc != "") {
                            $(opts.buttonLock).bind("click", function () {
                                opts.buttonFunc();
                            });
                        }
                    }
                }
            });

当页面放大时,如何防止它移出栏?

最佳答案

指向该问题的工作示例的链接将有助于解决该问题。

据我所知,我唯一能想到的是定位可能出了问题。您可以尝试通过将 position: relative; 添加到 slider 容器来解决此问题。

关于javascript - 当页面在移动站点中放大时, slider 停止移出屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56848313/

相关文章:

javascript - 在更改时在两个下拉菜单之间传递值。无需点击即可更新

javascript - 在 Google Maps API v3 中获取更新的半径/区域

javascript - 给 bootstrap popover 一个 ID

html - 列表列不会将边框向下推?

javascript - 当我调度事件()时,表单元素变为空白

javascript - 自动化地缩小大型 TypeScript 应用程序

jquery - JQgrid编辑表单重新加载

javascript - 代码在选定页面上不起作用?

jquery - CSS float : right

css - opera 和 box-shadow 插入到事件状态