Jquery仿IGoogle实现可拖动窗口示例代码 - Web前端
作者:98wpeu发布时间:2026-06-14分类:网页前端技术浏览:3
导读:google可谓是Ajax的特效用的淋漓尽致,Googlesuggest,googlemap,igoogle可拖动窗口等等...今天要做一个网站的类似效果,仿照iGoogl...
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 : '取消'
}
});
});
- 上一篇:jquery delay()介绍及使用指南 - Web前端
- 下一篇:已经是最后一篇了
相关推荐
- jquery delay()介绍及使用指南 - Web前端
- jquery根据属性和index来查找属性值并操作 - Web前端
- JQuery中使用Ajax赋值给全局变量失败异常的解决方法 - Web前端
- jquery动态分页效果堪比时光网 - Web前端
- input:checkbox多选框实现单选效果跟radio一样 - Web前端
- 基于Jquery实现键盘按键监听 - Web前端
- jquery用data方法获取某个元素上的事件 - Web前端
- jQuery中attr()和prop()在修改checked属性时的区别 - Web前端
- chrome下jq width()方法取值为0的解决方法 - Web前端
- jquery禁止输入数字以外的字符的示例(纯数字验证码) - Web前端
- 网页前端技术排行
- 最近发表
-
- WordPress随机显示特色图片插件:Random Post Thumbnails
- KeePass实现Chrome浏览器自动填充密码方法一
- LNMP一键包nginx 301强制跳转到https教程
- KeePass实现Chrome浏览器自动填充密码方法二
- #建站# 免费的VPS管理软件Xshell8/Xftp8中文版下载
- 使用Xshell 8连接VPS教程_电脑登录vps的方法
- WordPress评论界面添加烟花????效果
- 不同浏览器书签同步方案:坚果云+Floccus_详细使用教程
- iOS端KeePassXC客户端APP:Strongbox Password Safe
- 给WordPress评论中的Gravatar头像图片添加ALT属性


