Mobile-Iscroll Implementation date selection

Source: Internet
Author: User

Ah, said more is a tear;

Introducing the relevant JS file

<script type= "Text/javascript" src= "js/jquery-1.9.1.min.js" ></script> <script type= "Text/javascript "Src=" ></script> "Js/iscroll.js"

Style

 /* Date selection */. date{position:fixed;        top:0;        width:100%;        height:100%;        Display:none;    Background-color:rgba (0,0,0,.3);        }. Date. date-piker{width:750px;        Background-color: #fff;        font-size:26px;        Position:absolute;    bottom:0}        . date. date-piker. tit{height:80px;        line-height:80px;        Background-color: #f4f4f4;        Color: #474747; padding:0        26px;        Text-align:center}. Date. date-piker. Tit a{color: #ff6315;        Float:left}. Date. date-piker. Tit a:last-child{float:right}. Date. time-box{height:420px;        Overflow:hidden;        position:relative;        width:100%; padding:0        45PX}. Date. time-choose{height:70px;        border-top:1px solid #efefef;        border-bottom:1px solid #efefef;        Position:absolute;        top:140px;        left:-90px;        width:100%; Background-color: #fFF}. Date. time-01,. time-02,. time-03{Position:absolute;        Z-index:3;        height:420px; Overflow:hidden}. Date. time-02{left:240px}. Date. time-03{left:480px}. Date. time-bo        x li{height:70px;        line-height:70px;        Color: #474747;        Text-align:center;        Font-family:helvetica; width:220px}

HTML code Implementation

  <div class= Date > <div class= date-piker > <div class= ><a id= kidding > Fetch </a><span> Maintenance Time </span><a id= "sure" > OK </a></div> <div class= "Time-box"                ; <div class= "Time-choose" ></div> <div class= "time-01" id= "month" > <d iv> <ul> <li></li> <l i></li> <li>4 Month </li> <li                                                 >5 month </li> <li>6 month </li> <li>7 month </li>                            <li></li> <li></li>                <li></li> </ul> </div> </div> <div class= "time-02" id= "date" > <div> <u L> <li></li> <li></li>
<li>1 Day </li> <li>2 Day </li> <li>3 Day </li> <li>4 Day </li> <li>5 Day </li> <li></li> <li>< /li> </ul> </div> </div> < Div class= "time-03" id= "Time" > <div> <ul> <li></li> <li></li> <li>10:00</li> <li>15:00</li> <li>16 :00</li> <li>17:00</li> <li>18:00</li> <li></li> <li></li> < li></li> </ul> </div> </div> </div> </div> </div>

JS effect Add

 /* Date Selection */* There is a problem here this time about the month every number of days does not need to be dynamically generated */$ ('. Date_sure '). Click (function () {$ ('. Date '). Show ();        Scrolling effect scrolling ();                Confirm the result $ (' #sure '). Click (function () {if (GetContent ("#month")) {//Get the content selected in Ul Li in each div                $ ('. Date_sure '). HTML (getcontent ("#month") +getcontent ("#date") + '   ' + getcontent ("#time"));            $ ('. Date '). Hide ();        }        });        $ (' #kidding '). Click (function () {$ ('. Date '). Hide ();        });        var Myscroll; function scrolling () {myscroll = new Iscroll (' #date ', {scrolly:true, momentum:            False, snap: ' Li '});            Myscroll = new Iscroll (' #time ', {scrolly:true, momentum:false, snap: ' Li '            });  Myscroll = new Iscroll (' #month ', {scrolly:true, momentum:false, snap: ' Li '           });            } function GetContent (ele) {//finds the inner div var $content = $ (ele). Find (' div ');            Gets the height of an li var _height=$ (ele). Find (' li '). Height ();            Add transform move effect to inner div var tran = $content. CSS (' transform ');            var toparray=[];            The retrieved content becomes the last of the array to move the distance top toparray=tran.split (', ');            var Top=math.floor (parsefloat (toparray[5]));            Gets the number of moves minus the empty two li Var num=top/_height-2;        Returns the contents of the corresponding selected Li to return $ (ele+ "Li"). EQ (-num). text ();                 }    });

Finish the selection of this date

Mobile-Iscroll Implementation date selection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.