最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jQuery實(shí)現(xiàn)的跨容器無(wú)縫拖動(dòng)效果代碼

 更新時(shí)間:2016年06月21日 11:06:48   作者:cherry  
這篇文章主要介紹了jQuery實(shí)現(xiàn)的跨容器無(wú)縫拖動(dòng)效果代碼,可實(shí)現(xiàn)容器的任意添加與拖動(dòng)功能,涉及jQuery UI插件的使用技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)的跨容器無(wú)縫拖動(dòng)效果。分享給大家供大家參考,具體如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>New Web Project</title>
  <link type = "text/css" href = "jquery-ui.css" rel = "stylesheet"/>
  <style type = "text/css">
   .EZ_SITE{width:990px; position: relative; margin:0px auto; top:30px;}
   .EZ_SITE_HEADER{width:990px; position: absolute; height:80px; border:1px solid red;}
   .ez_site_border{position: absolute; width:100%; height:100%; background-color:#000;}
   .ez_site_background{position: absolute; width:100%; height:100%;background-color:#fff; margin:0px;}
   .EZ_SITE_PAGE{width:990px; height:500px; position: absolute;top:82px;border:1px solid blue;} 
   .ez_page_content{width:100%; height:100%; position: absolute;}
   .EZ_SITE_FOOTER{width:990px; position: absolute; height:80px; top:580px;border:1px solid green;}   
   #dragMe{
    position:absolute;
    top:100px;
    left:100px;
    width:100px;
    height:50px;
    border:1px solid green;
    line-height:50px;
    cursor:move;
    text-align: center;
    z-index:999;
    background:#008800;
   }
   .box{
    position:absolute;
    top:100px;
    left:300px;
    width:300px;
    height:200px;
    border:1px solid blue;
    line-height:200px;
    cursor:move;
    text-align: center;
    z-index:990;
    background:#ddd;
   }
  </style>
  <script type = "text/javascript" src = "jquery-1.7.1.min.js"> </script>
  <script type = "text/javascript" src="jquery-ui.js"> </script>
  <script type = "text/javascript">
   $(function(){
    var obj = {
       drop:function(e,ui){
        var handle = ui.helper,
         _left = handle.offset().left,
         _top = handle.offset().top,
         cleft = $(this).offset().left,
         ctop = $(this).offset().top;
        handle.appendTo($(this)).css({
         left:_left-cleft,
         top:_top-ctop
        });
       }
    }; 
    $("#addBox").click(function(){
     var $box = $('<div class = "box">box</div>');
     $box.appendTo($("#EZ_SITE_PAGE")).draggable().droppable(obj);
    })
    $("#dragMe,#box").draggable({
     containment:"#EZ_SITE"
    });
    $(".ez_page_content,#box").droppable(obj);
   })
  </script>
 </head>
 <body>
  <div id="EZ_SITE" class="EZ_SITE">
   <div id="EZ_SITE_HEADER" class="EZ_SITE_HEADER">
    <div class="ez_site_border">
     <div class="ez_site_background"></div>
    </div>
    <div class="ez_page_content">
     <div style="position: absolute; top:20px; left:30px;">這是一個(gè)網(wǎng)站標(biāo)題</div>
     <div style="position: absolute; top:20px; left:300px;" class="mk-element-navigation">
      <a href="javascript:;" id="index">主頁(yè)</a>
      <a href="javascript:;" id="product">產(chǎn)品</a>
     </div>
    </div>
   </div>
   <div id="EZ_SITE_PAGE" class="EZ_SITE_PAGE">
    <input type = "button" value = "添加容器" id = "addBox"/>
    <div class="ez_site_border" style="height:500px;">
     <div class="ez_site_background"></div>
    </div>
    <div id="index" class="ez_page_content" style="opacity: 1;" current="true">
     <div style="position: absolute; top:20px; left:30px; font-weight: bold;">這是一個(gè)主頁(yè)面</div>
     <div id = "dragMe">dragMe</div>
    </div>
   </div>
   <div id="EZ_SITE_FOOTER" class="EZ_SITE_FOOTER">
    <div class="ez_site_border">
     <div class="ez_site_background"></div>
    </div>
    <div class="ez_page_content">
     <div style="position: absolute; top:20px; left:30px;">這里是頁(yè)腳</div>
    </div>
   </div>
  </div>
 </body>
</html>

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery拖拽特效與技巧總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery常用插件及用法總結(jié)》、《jquery中Ajax用法總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)

希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • 深入理解JQuery keyUp和keyDown的區(qū)別

    深入理解JQuery keyUp和keyDown的區(qū)別

    這篇文章主要是對(duì)JQuery中keyUp與keyDown的區(qū)別進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
    2013-12-12
  • jquery實(shí)現(xiàn)炫酷的疊加層自動(dòng)切換特效

    jquery實(shí)現(xiàn)炫酷的疊加層自動(dòng)切換特效

    這篇文章主要給大家分享的是一則jquery實(shí)現(xiàn)炫酷的疊加層自動(dòng)切換特效,效果非常棒,這里推薦給小伙伴們。
    2015-02-02
  • jQuery中設(shè)置form表單中action值的實(shí)現(xiàn)方法

    jQuery中設(shè)置form表單中action值的實(shí)現(xiàn)方法

    下面小編就為大家?guī)?lái)一篇jQuery中設(shè)置form表單中action值的實(shí)現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-05-05
  • jquery實(shí)現(xiàn)動(dòng)態(tài)操作select選中

    jquery實(shí)現(xiàn)動(dòng)態(tài)操作select選中

    文章主要向大家介紹了jQuery 根據(jù)值或者文本選中select的方法和示例,非常實(shí)用的功能,需要的朋友可以參考下
    2015-02-02
  • jquery 列表雙向選擇器之改進(jìn)版

    jquery 列表雙向選擇器之改進(jìn)版

    自己以前做的列表雙向選擇器,感覺(jué)有點(diǎn)挫,昨天閑著沒(méi)事改進(jìn)了一下,把元素改成了select option這樣就支持shift多選,感覺(jué)好多了
    2013-08-08
  • jQuery實(shí)現(xiàn)的簡(jiǎn)單拖動(dòng)層示例

    jQuery實(shí)現(xiàn)的簡(jiǎn)單拖動(dòng)層示例

    這篇文章主要介紹了jQuery實(shí)現(xiàn)的簡(jiǎn)單拖動(dòng)層,可實(shí)現(xiàn)響應(yīng)鼠標(biāo)拖動(dòng)div層及動(dòng)態(tài)顯示坐標(biāo)值的功能,涉及jQuery鼠標(biāo)響應(yīng)及頁(yè)面元素屬性相關(guān)操作技巧,需要的朋友可以參考下
    2017-02-02
  • JQuery實(shí)現(xiàn)DIV其他動(dòng)畫效果的簡(jiǎn)單實(shí)例

    JQuery實(shí)現(xiàn)DIV其他動(dòng)畫效果的簡(jiǎn)單實(shí)例

    下面小編就為大家?guī)?lái)一篇JQuery實(shí)現(xiàn)DIV其他動(dòng)畫效果的簡(jiǎn)單實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-09-09
  • 多個(gè)jQuery版本共存的處理方案

    多個(gè)jQuery版本共存的處理方案

    本文給大家分享的是一個(gè)經(jīng)常需要碰到的問(wèn)題的解決方案,如何才能讓一個(gè)頁(yè)面中同時(shí)存在多個(gè)jQuery呢,這就是今天我們需要探討的話題了。
    2015-03-03
  • 使用jQuery實(shí)現(xiàn)Web頁(yè)面換膚功能的要點(diǎn)解析

    使用jQuery實(shí)現(xiàn)Web頁(yè)面換膚功能的要點(diǎn)解析

    網(wǎng)頁(yè)換膚的實(shí)質(zhì)就是切換CSS樣式,關(guān)鍵是給用戶做出點(diǎn)擊切換的功能以及換膚完成之后的緩存記錄功能,下面我們就來(lái)看一下使用jQuery實(shí)現(xiàn)Web頁(yè)面換膚功能的要點(diǎn)解析:
    2016-05-05
  • jquery 操作iframe的幾種方法總結(jié)

    jquery 操作iframe的幾種方法總結(jié)

    這篇文章主要是對(duì)使用jquery操作iframe的幾種方法進(jìn)行了詳細(xì)的總結(jié)介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
    2013-12-12

最新評(píng)論

梅州市| 修水县| 庄浪县| 顺平县| 天气| 江陵县| 固镇县| 连山| 嵊泗县| 嘉义市| 方正县| 四会市| 平舆县| 灌阳县| 汕头市| 赤水市| 正宁县| 民和| 依安县| 社会| 兴城市| 朝阳县| 和平区| 马边| 吉木萨尔县| 柳州市| 山东省| 龙口市| 满洲里市| 津南区| 普格县| 商城县| 五莲县| 新沂市| 金塔县| 襄樊市| 辽中县| 文化| 潞西市| 五莲县| 高尔夫|