移动版网站的滑动功能

Swipe function for mobile version of website

本文关键字:功能 网站 移动      更新时间:2023-09-26

引导程序是否为用户提供滑动幻灯片或图像的滑动功能?

如果没有,他们是否是一种简单的方法?我是javascript和coldfusion的初学者,并希望获得任何帮助,将我带到正确的方向或从哪里开始。

谢谢

不,Bootstrap 不提供这样的功能。我建议使用ZingTouch。以下是他们文档中的示例:

var parentTouchArea = document.getElementById('parent-toucharea')
var touchArea = document.getElementById('toucharea')
var myRegion = new ZingTouch.Region(parentTouchArea);
myRegion.bind(touchArea, 'swipe', function(e){
    console.log(e.detail);
});

你可以试试jQuery mobile,它有很多很棒的资源(你猜对了)移动,而且非常易于使用,而且网上有很多很棒的教程。

$(".elementClassName").on("swipe", function(){
    //jQuery or JS code here
});

请注意,您需要具有jQuery Mobile和jQuery的脚本文件(尽管不确定后者)才能运行代码

此外,如果你为iPhone或WebKit开发,你应该看看滚动捕捉,它只使用CSS而不是JavaScript来工作。在此链接上查看https://webkit.org/demos/scroll-snap/

看看 HammerJS: http://hammerjs.github.io/-- 它为许多触摸手势(包括滑动)提供了跨浏览器抽象。