zoukankan      html  css  js  c++  java
  • scroll-view——小程序横向滚动

    这是官方给的布局代码

    <view class="section">
      <view class="section__title">vertical scroll</view>
      <scroll-view scroll-y style="height: 200px;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{{toView}}" scroll-top="{{scrollTop}}">
        <view id="green" class="scroll-view-item bc_green"></view>
        <view id="red"  class="scroll-view-item bc_red"></view>
        <view id="yellow" class="scroll-view-item bc_yellow"></view>
        <view id="blue" class="scroll-view-item bc_blue"></view>
      </scroll-view>
    
      <view class="btn-area">
        <button size="mini" bindtap="tap">click me to scroll into view </button>
        <button size="mini" bindtap="tapMove">click me to scroll</button>
      </view>
    </view>
    <view class="section section_gap">
      <view class="section__title">horizontal scroll</view>
      <scroll-view class="scroll-view_H" scroll-x style=" 100%">
        <view id="green" class="scroll-view-item_H bc_green"></view>
        <view id="red"  class="scroll-view-item_H bc_red"></view>
        <view id="yellow" class="scroll-view-item_H bc_yellow"></view>
        <view id="blue" class="scroll-view-item_H bc_blue"></view>
      </scroll-view>
    </view>
    

      在文档上对css没有进行描述,要想横向滚动,首先要先把子元素设置成一行,发现float不能用

    要对子元素进行display:inline-block ,容器进行 white-space: nowrap;

    css如下:

    .scroll-view_H{
       100%;
      white-space: nowrap; 
    }
    .scroll-view-item_H{
       200px;
      height: 100px;
      display: inline-block;
    }
    

      

  • 相关阅读:
    Hadoop eclipse插件使用过程中出现的问题
    hadoop eclipse插件下载 1.1.2版本
    Hbase 行键设计
    Js权限判断处理
    ASP.NET MVC中给所有的cshtml页面引用命名空间
    jquery实现的网页选项卡(拾忆)
    angularjs 请求后端接口请求了两次
    Entity Framework Code First关系映射约定
    Angularjs中link函数参数含义小节
    浅谈AngularJS中的$parse和$eval
  • 原文地址:https://www.cnblogs.com/Anne3/p/7053643.html
Copyright © 2011-2022 走看看