標籤:style blog http color io os ar for sp
昨天給大家介紹了一款基於jquery ui漂亮的可拖動div執行個體,今天要給大家分享一款基於jquery的可拖動div。這款可拖動div只要引用jquery就可以,無需引用jquery ui。還即時記錄的滑鼠的座標。一起看下吧。
線上預覽 源碼下載
實現的代碼。
html代碼:
<span class="text noselect">DRAGGIN‘ WINDOWS<br /> <a href="http://www.w2bc.com">This is an old one. Click HERE for access the newer one.</a></span> <div class="window noselect"> <div class="pew"> Header </div> <div class="container"> The Cords </div> </div>
css代碼:
.noselect { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } html { width: 100%; height: 100%; } body { background: radial-gradient(#ACBEC8, #3A4E57); margin: 0; width: 100%; height: 100%; font-family: ‘Raleway‘ , sans-serif; } .testtext { width: 100%; color: white; text-align: center; display: inline-block; padding-top: 30vh; font-size: 48px; text-shadow: 0 0 6px #333; } .text { width: 100%; color: white; text-align: center; display: inline-block; padding: 40px 0; font-size: 48px; line-height: 30px; } .text a { text-decoration: none; font-size: 15px; line-height: 20px; color: white; } .window { width: 500px; height: 300px; background: #181818; margin-left: -250px; left: 50%; position: absolute; } .pew { width: 100%; height: 30px; text-align: center; line-height: 30px; color: #111; background: #E31836; cursor: default; } .container { width: 100%; height: calc(100% - 30px); color: #eee; padding: 35px 0 0 0; text-align: center; font-size: 36px; }
註:本文愛編程原創文章,轉載請註明原文地址:http://www.w2bc.com/Article/8756
基於jquery的可拖動div