使用JQuery UI插件以拖动的方式管理图片8-9
来源:互联网 发布:db2和mysql sql语句 编辑:程序博客网 时间:2024/05/21 17:29
html代码:
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>使用JQuery UI插件以拖动的方式管理图片</title><script type="text/javascript" src="lib/jquery-2.1.1.js"></script><script type="text/javascript" src="lib/jquery-ui.min.js"></script><link rel="stylesheet" type="text/css" href="css/jquery-ui.css"><link rel="stylesheet" type="text/css" href="8-9.css"><script type="text/javascript">$(function(){var $photo = $("#photo");var $trash = $("#trash");$("li",$photo).draggable({revert:"invalid",helper:"clone",cursor:"move"});$trash.droppable({accept:"#photo li",activeClass:"highlight",drop:function(event,ui){deleteImage(ui.draggable)}});$photo.droppable({accept:"#trash li",activeClass:"active",drop:function(event,ui){recyleImage(ui.draggable);}});var recylelink = "<a href='#' title='从回收站还原' class='phrefresh'>还原</a>";function deleteImage($item){$item.fadeOut(function(){var $list = $("<ul class='photo reset'/>").appendTo($trash);$item.find("a.phtrash").remove();$item.append(recylelink).appendTo($list).fadeIn(function(){$item.animate({width:"100px"}).find("img").animate({height:"100px"});});});}var trashlink = "<a href='#' title='放入回收站' class='phtrash'>删除</a>";function recyleImage($item){$item.fadeOut(function(){$item.find("a.phrefresh").remove().end().css("width","100px").append(trashlink).find("img").css("height","100px").end().appendTo($photo).fadeIn();});}$("ul.photo li").click(function(event){var $item = $(this),$target = $(event.target);if($target.is("a.phtrash")){deleteImage($item);}else if($target.is("a.phrefresh")){recyleImage($item);}return false;});});</script></head><body><div class="phframe"><ul id="photo" class="photo"><li class="photoframecontent photoframetr"><h5 class="photoframeheader">图片1</h5><img src="../Images/001.gif" alt = "" width="100px" height="100px"/><span>图片1说明</span><a href="#" title="放入回收站" class="phtrash">删除</a></li><li class="photoframecontent photoframetr"><h5 class="photoframeheader">图片2</h5><img src="../Images/002.gif" alt = "" width="100px" height="100px"/><span>图片2说明</span><a href="#" title="放入回收站" class="phtrash">删除</a></li><li class="photoframecontent photoframetr"><h5 class="photoframeheader">图片3</h5><img src="../Images/003.gif" alt = "" width="100px" height="100px"/><span>图片3说明</span><a href="#" title="放入回收站" class="phtrash">删除</a></li></ul><div id="trash" class="photoframecontent"><h4 class="photoframeheader">回收站</h4></div></div></body></html>
css代码:
@CHARSET "UTF-8";body{font-size:11px;font-family:Verdana,Arial,sans-self;}#photo{float:left;width:55%;min-height:12em;padding:0;margin:0px;list-style-type:none;}#photo li{float:left;width:96px;padding:0.4em;margin:0 0.4em 0.4em 0;text-align:center;}#photo li h5{margin:0 0 0.4em;cursor:move;}#photo li span{float:left;}#photo li a{float:right;}#photo li img{width:98%;cursor:move;border:solid 1px #eee;margin-bottom:3px}.phframe{width:1000px;}.photoframecontent{border:1px solid #ccc;color:#666;}.photoframecontent a{color:#666;}.photoframeheader{border:1px solid #ccc;background-color:#ccc;color:#666;font-weight:bold';}.photoframeheader a{color:#666;}.photoframetr{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;}.active{background:#eee;}.highlight{border:1px solid #fcefa1;background:#fbf9ee}.reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style-:none}.phtrash,.phrefresh{color:#666;}#trash{float:right;width:42%;min-height:18em;padding:1%;}#trash h4{line-height:16px;margin:0 0 0.4em;padding:4px 0px 0px 4px;}#trash .photo h5,#trash span{display:none;}
0 0
- 使用JQuery UI插件以拖动的方式管理图片8-9
- jQuery 插件 jQuery UI的使用
- jquery插件实现图片可拖动的购物车代码
- jquery ui的拖动排序
- jquery-ui的sortable插件使用示例
- jquery-ui-datepicker插件的使用
- jquery-ui日历插件的使用步骤
- jQuery-ui包的使用方式
- java + jquery-ui.sortable.js插件实现表格拖动排序
- Jquery autocomplete和jQuery UI Autocomplete插件的使用
- 利用Jquery的cropper插件实现拖动层动态头剪切(裁剪头像)图片
- 仿QQ查看图片的jQuery插件,可旋转,缩放和拖动。
- ZoomMarker 一款用于图片滚动放大拖动,且可以添加标记的jQuery插件
- 拖动表头的一个jquery插件
- 基于jquery的html5简单拖动插件
- jQuery-ui插件datepicker的参数使用详解
- jQuery-ui插件datepicker的参数使用详解
- jQuery-ui插件datepicker的参数使用详解
- org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row
- 加密解密总结
- Windows下OpenSSL安装配置
- Tips running Hadoop on Ubuntu
- fscanf()函数详解
- 使用JQuery UI插件以拖动的方式管理图片8-9
- 利用函数访问私有数据成员
- jdk环境变量配置
- 基于标签方式的工作流启动及任务执行开发说明
- 苹果列出了app被拒最常见原因,你中枪了吗?
- 如何基于谷歌地图的Server缓存发布Image Service服务
- 深入浅出UML类图
- 《山居秋暝》 王维
- 编程精华资源书籍大汇总