JS+CSS implementation of drag paging effect instance

Source: Internet
Author: User

This article illustrates the Js+css method for implementing drag paging effects. Share to everyone for your reference. The implementation methods are as follows:

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 5, 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 11 9 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148-149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179-18 0 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201-202 <html> <head> <title> Drag page </title> <meta http-equiv=content-type content= "text/html; Charset=utf-8 "> <style> body{border:0px; margin:0px; overflow:hidden; background-color:transparent;} page{ Position:absolute; width:700px; border:1px solid #999; Background-color: #000; left:425px; margin-left:-350px; Cursor:default; z-index:0; ul{height:320px; list-style:none margin:40px 50px 0px padding:0px; li{width:100%; height:30px; f ont-size:14px; Text-align:left; border-bottom:1px dashed #999; a{Text-decoration:none color: #999;} a:hover{font-weight:bold;} li span{float:right; color: #999; tip{DISPLAY:BL Ock; width:100%; font-size:12px; Color: #999; Text-align:center; margin:10px 0px 20px; } </style> </head> <body onselectstart= "return false;" > <script> function ID (obj) {return document.getElementById (obj);} var page; var lm,mx; var Md=false; var sh=0; var En=false; Window.onload=function () {Page=docUment.getelementsbytagname ("div"); if (page.length>0) {page[0].style.zindex=2} for (i=0;i<page.length;i++) {page[i].classname= "page"; Page[i]. innerhtml+= "<span class=" Tip > "+ (i+1) +"/"+page.length+" page tip: Drag and drop pages </span> "; Page[i].id= "page" +i; Page[i].i=i; Page[i].onmousedown=function (e) {if (!en) {if (!e) {e=e| | window.event;} Lm=this.offsetleft; mx= (E.pagex) e.pagex:e.x; This.style.cursor= "W-resize"; Md=true; if (document.all) {this.setcapture ();} else{window.captureevents (event.mousemove| Event.mouseup); }} page[i].onmousemove=function (e) {if (MD) {en=true; if (!e) {e=e| | window.event;} var ex= (E.pagex) e.pagex:e.x; this.style.left=ex-(MX-LM) +350; if (this.offsetleft<75) {var cu= (this.i==0)? page.length-1:this.i-1; page[sh].style.zindex=0; PAGE[CU]. Style.zindex=1; this.style.zindex=2; SH=CU; } if (this.offsetleft>75) {var cu= (this.i==page.length-1)? 0:this.i+1; page[sh].style.zindex=0; PAGE[CU]. Style.zindex=1; this.style.zindex=2; SH=CU; }} page[i].onmouseup=function ({this.style.cursor= "default"; Md=false if (document.all) {this.releasecapture ();} else{window.releaseevents (event.mousemove| Event.mouseup); } flyout (this); }} function flyout (obj) {if (obj.offsetleft<75) {if (Obj.offsetleft + 350-20) > -275) {obj.style.left=obj.offs Etleft + 350-20; Window.settimeout ("Flyout (ID ('" +obj.id+ "));", 0; }else{obj.style.left=-275; obj.style.zindex=0 flyin (ID (obj.id));} if (obj.offsetleft>75) {if (Obj.offsetleft + +) < 1125) {obj.style.left=obj.offsetleft + +; window.se Ttimeout ("Flyout (ID ('" +obj.id+ "));", 0; }else{obj.style.left=1125; obj.style.zindex=0 flyin (ID (obj.id));} } function Flyin (obj) {if (obj.offsetleft<75) {if (Obj.offsetleft + +) < 425) {Obj.style.left=obj.offsetleft + 350 + 20; Window.settimeout ("Flyin (ID ('" +obj.id+ "));", 0; }else{obj.style.left=425; en=false;} if (obj.offsetleft>75) {if (Obj.offsetleft + 350-20) > 425) {obj.style.left=obj.offsetleft + 350-20; window.sEttimeout ("Flyin (ID ('" +obj.id+ "));", 0; }else{obj.style.left=425; en=false;} } </script> <div> <ul> <li><span>2009-4-29 02:16</span><a href=#> Oriental Pearl </ a></li> <li><span>2009-4-29 02:16</span><a href=#>! Lover </a></li> <li><span>2009-4-29 02:16</span><a href=#> Serenity Spa </a></li > <li><span>2009-4-29 02:16</span><a href=#> you look </a></li> <li>< span>2009-4-29 02:16</span><a href=#> Love song 1980</a></li> <li><span>2009-4-29 02:16</span><a href=#> 1980</a></li> <li><span>2009-4-29 02:16</span> <a href=#> 2000</a></li> <li><span>2009-4-29 02:16</span><a href=#> Asia's Orphans </a></li> <li><span>2009-4-29 02:16</span><a href=#> Childhood </a></li > </ul> </div> <div> <ul> <li><span>2009-4-29 02:16</span><a href=#> libretto </a></li> <li><span >2009-4-29 02:16</span><a href=#> Rook </a></li> <li><span>2009-4-29 02:16</ Span><a href=#> Oriental Pearl </a></li> <li><span>2009-4-29 02:16</span><a href=# > Rolling Red dust </a></li> <li><span>2009-4-29 02:16</span><a href=#> Time Story </a> </li> <li><span>2009-4-29 02:16</span><a href=#> archaisms </a></li> <li> <span>2009-4-29 02:16</span><a href=#> Phenomenon 72 change </a></li> <li><span> 2009-4-29 02:16</span><a href=#> nostalgic four rhyme </a></li> <li><span>2009-4-29 02:16</ Span><a href=#> through your dark hair my hand </a></li> </ul> </div> <div> <ul> <li> <span>2009-4-29 02:16</span><a href=#>, private song </a></li> <li><span>2009-4-29 02:16</span><a href=#> Yellow face </a></li> <li><span>2009-4-29 02:16</ Span><a href=#> Taipei Red Rose </a></li> </ul> </div> </body> </html>

The

wants this article to help you with your JavaScript programming.

Related Article

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.