Javascript 可滑动内联按钮移动

Javascript 可滑动内联按钮移动,javascript,jquery,html,css,jquery-mobile,Javascript,Jquery,Html,Css,Jquery Mobile,我有一个有序的内联按钮列表,这些按钮是我用来离开屏幕的。我想让这些按钮可以滑动,这样你就可以找到那些离开屏幕的按钮 <style> .banner-test { transition: all 0.4s ease; overflow: hidden; height: auto; padding: .625em .850em; position: fixed; z-index:

我有一个有序的内联按钮列表,这些按钮是我用来离开屏幕的。我想让这些按钮可以滑动,这样你就可以找到那些离开屏幕的按钮

   <style>
    .banner-test {
        transition: all 0.4s ease;
        overflow: hidden;
        height: auto;
        padding: .625em .850em;
        position: fixed;
        z-index: 100;
        bottom: 0px;
        width: 100%;
        /* Fallback for web browsers that doesn't support RGBa */
        background: rgb(0, 0, 0);
        /* RGBa with 0.6 opacity */
        background: rgba(0, 0, 0, 0.6);
        /* For IE 5.5 - 7*/
        filter: progid: DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);
        /* For IE 8*/
        -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";
        -webkit-transform: translate3d(0, 0px, 0);
        transform: translate3d(0, 0px, 0);
    }
    .ui-btn {
        background: #f6f6f6;
        border-color: #ddd;
        color: #333;
        text-shadow: 0 1px 0 #f3f3f3;
        font-weight: 700;
        font-size: 16px;
        margin: .5em 0;
        padding: .7em 1em;
        display: block;
        border-width: 1px;
        border-style: solid;
        position: relative;
        text-align: center;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        cursor: pointer;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    .ui-btn:link {
        text-decoration: none;
    }
    .ui-btn-inline {
        display: inline-block;
        vertical-align: middle;
        margin-right: .625em;
    }
    .swiper-holder {
        width: 170%;
        white-space: nowrap;
    }
    .swiper-holder div {
        width: 16%;
        display: inline;
    }
</style>
<div class="banner-test">
    <div class="swiper-holder">
        <div><a href="#" class="ui-btn ui-btn-inline">Button</a></div>
        <div><a href="#" class="ui-btn ui-btn-inline">Button</a></div>
        <div><a href="#" class="ui-btn ui-btn-inline">Button</a></div>
        <div><a href="#" class="ui-btn ui-btn-inline">Button</a></div>
        <div><a href="#" class="ui-btn ui-btn-inline">Button</a></div>
        <div><a href="#" class="ui-btn ui-btn-inline">Button</a></div>
        <div><a href="#" class="ui-btn ui-btn-inline">Button</a></div>
        <div><a href="#" class="ui-btn ui-btn-inline">Button</a></div>
    </div>
</div>

.横幅测试{
过渡:所有0.4s缓解;
溢出:隐藏;
高度:自动;
填充:.625em.850em;
位置:固定;
z指数:100;
底部:0px;
宽度:100%;
/*不支持RGBa的web浏览器的回退*/
背景:rgb(0,0,0);
/*不透明度为0.6的RGBa*/
背景:rgba(0,0,0,0.6);
/*对于IE 5.5-7*/
过滤器:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000);
/*对于IE 8*/
-ms过滤器:“progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000)”;
-webkit转换:translate3d(0,0px,0);
变换:translate3d(0,0px,0);
}
.ui btn{
背景:#f6f6f6;
边框颜色:#ddd;
颜色:#333;
文本阴影:0 1px 0#f3;
字号:700;
字体大小:16px;
边缘:.5em0;
填充:.7em 1em;
显示:块;
边框宽度:1px;
边框样式:实心;
位置:相对位置;
文本对齐:居中;
文本溢出:省略号;
溢出:隐藏;
空白:nowrap;
光标:指针;
-webkit用户选择:无;
-moz用户选择:无;
-ms用户选择:无;
用户选择:无;
}
.ui btn:链接{
文字装饰:无;
}
.ui btn内联{
显示:内联块;
垂直对齐:中间对齐;
保证金权利:.625em;
}
.泳衣架{
宽度:170%;
空白:nowrap;
}
.swiper-holder分区{
宽度:16%;
显示:内联;
}
可以直接在jQuery中执行此操作吗?我已经看过并了解了touchend、touchstart等,但我真的不知道从哪里开始,大多数浏览器都支持它吗

网络上没有这方面的内容,我也没有见过其他人这样做


Fiddle:

你能试试这个插件吗


它提供所有类型的触摸事件,在所有设备上都能正常工作。

这是一种将按钮保存在包装器中的方法,当浏览器窗口的宽度变小时,它将启用一个滚动条,您可以用手指在手机上滑动

HTML

<div class="wrapper">
    <input type="button" class="button" value="Select">
    <input type="button" class="button" value="Select">
    <input type="button" class="button" value="Select">
    <input type="button" class="button" value="Select">
    <input type="button" class="button" value="Select">
    <input type="button" class="button" value="Select">
     <input type="button" class="button" value="Select">
</div>

    body {
      background-color: #333;
    }
    .wrapper {
      width: 100%;
      white-space: nowrap;
      overflow-y: hidden;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding: 1rem;
      background-color: #ccc;
    }

.internal {
  display: inline;
  background-color: wheat;
  &:nth-child(odd) {
    background-color: hotpink;
  }
}