Jquery仿IGoogle實現可拖動視窗範例程式碼_jquery

來源:互聯網
上載者:User

google可謂是ajax的特效用的淋漓盡致,google suggest, google map,igoogle 可拖動視窗等等...今天要做一個網站的類似效果,仿照iGoogle做了一個簡單的小demo。

這個的demo是根據一個Jquery的架構直接做出來的:easywidgets。這個架構是可以免費下載的http://plugins.jquery.com/project/easywidgets。

廢話就不多說了,直接把原始碼貼出來,讓大家學習!
html

<html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" type="text/css" media="screen" href="css/my.css" rel="external nofollow" rel="external nofollow" mce_href="css/my.css" rel="external nofollow" rel="external nofollow" /><script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery.easywidgets.js"></script>
<script src="js/example.js" type="text/javascript"></script>
</head><body><!--left--><div id="left" class="widget-place column1"><div id="ldiv1" class="widget movable"><div id="header" class="widget-header"><strong>drar me</strong> </div><div id="content" class="widget-content">左邊-----用滑鼠拖動</div> </div><div id="ldiv2" class="widget movable"><div id="header" class="widget-header"><strong>drar me</strong> </div><div id="content" class="widget-content">左邊-----用滑鼠拖動</div></div><div id="ldiv3" class="widget movable"><div id="header" class="widget-header"><strong>drar me</strong> </div><div id="content" class="widget-content">左邊-----用滑鼠拖動</div></div></div><!--middle--><div id="middle" class="widget-place column2"> <div id="mdiv1" class="widget movable collapsable removable editable"><div id="header" class="widget-header"><strong>drar me</strong> </div><div class="widget-editbox" style="background:#CC6699" mce_style="background:#CC6699">這裡就是放編輯的內容,為了顯眼,我加了背景</div><div id="content" class="widget-content">中間------用滑鼠拖動</div></div><div id="mdiv2" class="widget movable removable editable"><div id="header" class="widget-header"><strong>drar me</strong> </div><div id="content" class="widget-content">中間------用滑鼠拖動</div></div><div id="mdiv3" class="widget movable removable editable"><div id="header" class="widget-header"><strong>drar me</strong> </div><div id="content" class="widget-content">中間------用滑鼠拖動</div></div></div><!--right--><div id="right" class="widget-place column3"><div id="rdiv1" class="widget movable"> <div id="header" class="widget-header"><strong>drar me</strong> </div><div id="content" class="widget-content">右邊------用滑鼠拖動</div></div><div id="rdiv2" class="widget movable"><div id="header" class="widget-header"><strong>drar me</strong> </div><div id="content" class="widget-content">右邊------用滑鼠拖動</div></div><div id="rdiv3" class="widget movable"><div id="header" class="widget-header"><strong>drar me</strong> </div><div id="content" class="widget-content">右邊------用滑鼠拖動</div></div></div></body></html>

CSS

body{margin: 0;padding: 0;background-color: silver;font-family: 'Lucida Grande','Lucida Sans Unicode','宋體','新宋體',arial,verdana,sans-serif; color: #666; font-size:20px; line-height:150%; }#left{width: 380px;height: 100%;padding: 10px;position: absolute;top: 10px;left: 10px;border: solid red 2px; }#left .widget {width: 340px;height: 150px;padding; 10px;margin: 20px;border: solid red 2px;background-color: white;}#left .widget .widget-header {width: 340px;height: 30px;padding: 0;margin: 0;color: red;position: static;background-color: gray;}#middle{width: 400px;height: 100%;position: absolute;top:10px;left: 435px;padding: 10px;margin: 0 30px 0; border: solid red 2px; }#middle .widget {width: 360px;height: 150px;padding; 10px;margin: 20px;border: solid red 2px;background-color: white;}#middle .widget .widget-header {width: 360px;height: 30px;padding: 0;margin: 0;color: red;position: static;background-color: gray;}#right{width: 380px;height: 100%;padding: 10px;position: absolute;top: 10px;right: 10px;border: solid red 2px; }#right .widget {width: 340px;height: 150px;padding; 10px;margin: 20px;border: solid red 2px;background-color: white;}#right .widget .widget-header {width: 340px;height: 30px;padding: 0;margin: 0;color: red;position: static;background-color: gray;}

javascript代碼

$(document).ready(function(){ $.fn.EasyWidgets({i18n : { editText : '編輯', closeText : '關閉', extendText : '展開', collapseText : '摺疊', cancelEditText : '取消' }});});

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.