基於jquery的可拖動div

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.