Swipe to select a date (Sui-mobile-based mobile)

Source: Internet
Author: User

1$ (page). On (' Touchmove ', ' #touchMoveTime ',function(event) {2 TouchMove (event);3         });4Scrollbarinit ();//Initialize5         functionScrollbarinit () {6             varDefaultValue = 3,maxvalue = 30;7             varMyDate =NewDate ();8             varYear =mydate.getfullyear ();9             varmonth = Mydate.getmonth () + 1;//Get the current month (0-11, 0 for January)Ten             varDate =mydate.getdate (); One             varDay =NewDate (year,month,0); A             varDaycount = Day.getdate ();//get the number of days this month: -             if(date + defaultvalue) >Daycount) { -                 if(Month = = 12){ themonth = 1; -Year = year + 1; -}Else{ -Month = month + 1; +                 } -Date = (date + defaultvalue)-Daycount; +}Else{ ADate = date +DefaultValue; at             } -             if(Month < 10){ -month = "0" +month; -             } -             if(Date < 10){ -Date = "0" +date; in             } -  to$ ("#endTime"). attr (' value ', year+ '-' +month+ '-' +date); +             varCurrentX = $ ("#touchMoveTime"). Width () * (0/maxValue); -$ (' #scroll_Track '). CSS ({width:currentx+ "px")}); the$ (' #scroll_Thumb '). CSS ({transform: ' Translate (' + CurrentX + ' px, 0) '}); *  $         };Panax Notoginseng         functionTouchMove (event) { - Event.preventdefault (); the             if(!$ (' #scroll_Thumb ') | |!event.touches.length)return; +             varDefaultValue = 3,maxvalue = 30; A             varMyDate =NewDate (); the             varYear =mydate.getfullyear (); +             varmonth = Mydate.getmonth () + 1;//Get the current month (0-11, 0 for January) -             varDate =mydate.getdate (); $  $             varTran_currentx = ' '; -             varStartoffset = parseint ($ (' #touchMoveTime ')). Offset (). left); -             varEndoffset = parseint ($ (' #touchRight ')). Offset (). left); the             var_limit = Endoffset-Startoffset; -             varTouchmovetimeoffsetleft = $ (' #scroll_Track '). Offset (). Left;Wuyi             varTouch = Event.touches[0]; the             varEndX =Touch.pagex; -             varCurrentX = EndX-Touchmovetimeoffsetleft; Wu             varTimeValue = Math.Round (MaxValue * (CurrentX/$ ("#touchMoveTime"). Width ()));//Current Tick value -             if(TimeValue <DefaultValue) { AboutTimeValue =DefaultValue $}Else if(TimeValue >maxValue) { -TimeValue =MaxValue; -             } -             if(CurrentX < _limit && CurrentX > 15){ A$ (' #days '). Text (timevalue); +$ (' #scroll_Track '). CSS ({width:currentx+ "px")}); the                 if(CurrentX < 20){ -Tran_currentx = 0 $}Else{ theTran_currentx = currentX-20; the                 } the$ (' #scroll_Thumb '). CSS ({transform: ' Translate (' + Tran_currentx + ' px, 0) '}); the  -                 varDay =NewDate (year,month,0); in                 varDaycount = Day.getdate ();//get the number of days this month the                 if(date + timevalue) >Daycount) { the                     if(Month = = 12){ Aboutmonth = 1; theYear = year + 1; the}Else{ theMonth = month + 1; +                     } -Date = (date + timevalue)-Daycount; the}Else{BayiDate = date +TimeValue; the                 } the                 if(Month < 10){ -month = "0" +month; -                 } the                 if(Date < 10){ theDate = "0" +date; the                 } the$ (' #endTime '). attr (' value ', year+ '-' +month+ '-' +date); -             } the}
1 <Divclass= "Cllist">2     <spanclass= "Cl-15 pull-left">3 days</span>3    <DivID= "Touchmovetime"class= "Jzrqdiv cl-70 pull-left">4           <DivID= "Scroll_track"></Div>5           <Divclass= "Spirit Icon"ID= "Scroll_thumb">& #xe669;</Div>6    </Div>7    <spanclass= "cl-15 pull-left text-right"ID= "Touchright">30 days</span>8 </Div>
1 . Jzrqdiv{position:relative;Top:15px;Height:10px;Border-radius:20px;background:#efefef;Box-shadow:inset 0 1px 2px rgba (0,0,0,.15); }2 #scroll_Track{position:Absolute;Top:0;Height:10px;Border-radius:20px;background:#2399dc;Z-index:Ten;}3 . Spirit{position:Absolute;Top:-9px;width:30px;Height:30px;Line-height:30px;font-size:30px;Border-radius:50%;Color:#ddd;background:#fff;Z-index: One;Transform:Translate (0,0);}

The effect is as follows:

Swipe to select a date (Sui-mobile-based mobile)

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.