【问题标题】:Why data-position="fixed" data-tap-toggle="false" not work?为什么 data-position="fixed" data-tap-toggle="false" 不起作用?
【发布时间】:2019-06-05 07:01:35
【问题描述】:

我想在滚动内容时修复我的按钮。我使用了这个data-position="fixed"data-tap-toggle="false"。但它不起作用,按钮也向上滚动。 当我使用绝对位置时,它位于底部。所以我使用相对位置。如果我将这些按钮添加到标题中,那么背景蓝色将显示在按钮上。 您能否建议另一种方式,以便在我滚动内容时修复按钮。

我点击它显示按钮和文本字段的按钮。然后滚动我的竞争按钮也滚动。 这是我的小提琴。 http://jsfiddle.net/ravi1989/E65Uy/

$(document).on('click', '#test', function() {

   $("#searchbar").toggle("slow");
});

【问题讨论】:

  • 你不想要蓝色顶栏上的按钮?
  • 不..你理解错了
  • 我需要按钮应该出现在文本上方..

标签: javascript jquery css jquery-mobile


【解决方案1】:

我通过禁用 CSS 动画解决了这个问题..

.slidedown, .reverse, .out {
    -o-transition-property: none !important;
    -moz-transition-property: none !important;
    -ms-transition-property: none !important;
    -webkit-transition-property: none !important;
    transition-property: none !important;
    -o-transform: none !important;
    -moz-transform: none !important;
    -ms-transform: none !important;
    -webkit-transform: none !important;
    transform: none !important;
    -webkit-animation: none !important;
    -moz-animation: none !important;
    -o-animation: none !important;
    -ms-animation: none !important;
    animation: none !important;
}

【讨论】:

    【解决方案2】:
      data-position="fixed" data-tap-toggle="false"  
    

    用于 data-role="header" 标签,不用于其他 div 或元素

    参考这个,http://jquerymobile.com/demos/1.2.0/docs/toolbars/bars-fixed.html

    你应该使用css样式属性位置来固定其他元素

    【讨论】:

    • css 属性如位置:固定
    • 示例中的按钮在滚动时是固定的。这就是你想要的对吗?
    • @Rohit jsfiddle.net/ravi1989/E65Uy/10 为我工作,只是没有背景
    • 但按钮在文本上方。我不需要这个..按钮应该出现然后文本
    【解决方案3】:

    我已经对您的小提琴进行了更改。

    我更改了这一行:<div data-role="header" data-theme="b" data-position="fixed" data-tap-toggle="false" style='z-index:9999'>

    编辑:

    我换了小提琴,这是你要找的吗?

    http://jsfiddle.net/E65Uy/11/

    【讨论】:

    • 但按钮也会滚动?
    • 您不希望稍后出现的按钮也滚动?
    • 是的..如果我使用点击按钮。它显示按钮。那么他们不应该滚动
    • 只需将按钮添加到标题div 本身。
    猜你喜欢
    • 2012-11-07
    • 1970-01-01
    • 1970-01-01
    • 2017-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-12
    • 1970-01-01
    相关资源
    最近更新 更多