index.html

        iNettuts - Welcome!

iNettuts

简介窗口

如果你活着,早晚都会死;如果你死了,你就永久活着。

窗口标题

世界上本没有路,有了腿便有了路。

窗口标题

1个人只能全力以赴,等待命运去揭晓答案。

窗口标题

望着沧茫大海,令我得到片刻摆脱;不怀缅过去,也不展望未来。

窗口标题

就像这些樱花,每一个生命都会凋零。每吸1口气,每喝1杯茶,每杀1个人都能体悟人生,这就是武士精神。

窗口标题

人应竭尽所能,然后听天由命。

inettuts.js

var iNettuts = {    jQuery : $,    settings : {        columns : '.column',        widgetSelector: '.widget',        handleSelector: '.widget-head',        contentSelector: '.widget-content',        widgetDefault : {            movable: true,            removable: true,            collapsible: true,            editable: true,            colorClasses : ['color-yellow', 'color-red', 'color-blue', 'color-white', 'color-orange', 'color-green']        },        widgetIndividual : {            //个别的模块            intro : {                movable: false,                removable: false,                collapsible: false,                editable: false            },            dingzh : {                movable: false,                removable: false,                collapsible: true            }        }    },    //初始化    init : function () {        this.attachStylesheet('inettuts.js.css');        this.addWidgetControls();        this.makeSortable();    },    getWidgetSettings : function (id) {        var $ = this.jQuery,            settings = this.settings;            //判断ID模块是不是定义过        return (id&&settings.widgetIndividual[id]) ? $.extend({},settings.widgetDefault,settings.widgetIndividual[id]) : settings.widgetDefault;    },    //动态追加元素    addWidgetControls : function () {        var iNettuts = this,            $ = this.jQuery,            settings = this.settings;        //设置选择器环境        //默许情况下,选择器从文档根部对 DOM 进行搜索。不过,可以为 $() 设置可选的 context 参数。        //如果我们希望在1个 .column类属性 的对象中 中搜索1个.widget类属性的 元素,可以限定下面的搜索:        $(settings.widgetSelector, $(settings.columns)).each(function () {            //遍历匹配的结果            var thisWidgetSettings = iNettuts.getWidgetSettings(this.id);            //移除窗体元素            if (thisWidgetSettings.removable) {                $('CLOSE').mousedown(function (e) {                    //禁止事件冒泡                    e.stopPropagation();                    }).click(function () {                    if(confirm('这个小部件将被删除,肯定吗?')) {                        $(this).parents(settings.widgetSelector).animate({                            opacity: 0                            },function () {                            $(this).wrap('

改变标题吗?') .append((function(){ var colorList = '可用的色彩: '; $(thisWidgetSettings.colorClasses).each(function () { colorList += ''; }); return colorList + ''; })()) .append('') .insertAfter($(settings.handleSelector,this)); } //折叠 if (thisWidgetSettings.collapsible) { $('COLLAPSE').mousedown(function (e) { e.stopPropagation(); }).toggle(function () { $(this).css({backgroundPosition: '⑶8px 0'}) .parents(settings.widgetSelector) .find(settings.contentSelector).hide(); return false; },function () { $(this).css({backgroundPosition: '⑸2px 0'}) .parents(settings.widgetSelector) .find(settings.contentSelector).show(); return false; }).prependTo($(settings.handleSelector,this)); } }); $('.edit-box').each(function () { $('input',this).keyup(function () { $(this).parents(settings.widgetSelector).find('h3').text( $(this).val().length>20 ? $(this).val().substr(0,20)+'...' : $(this).val() ); }); $('ul.colors li',this).click(function () { var colorStylePattern = /bcolor-[w]{1,}b/, thisWidgetColorClass = $(this).parents(settings.widgetSelector).attr('class').match(colorStylePattern) if (thisWidgetColorClass) { $(this).parents(settings.widgetSelector) .removeClass(thisWidgetColorClass[0]) .addClass($(this).attr('class').match(colorStylePattern)[0]); } return false; }); }); }, attachStylesheet : function (href) { var $ = this.jQuery; return $('').appendTo('head'); }, //排序窗体布局 makeSortable : function () { var iNettuts = this, $ = this.jQuery, settings = this.settings, $sortableItems = (function () { var notSortable = ''; $(settings.widgetSelector,$(settings.columns)).each(function (i) { //判断是不是具有可移动属性 if (!iNettuts.getWidgetSettings(this.id).movable) { if(!this.id) { this.id = 'widget-no-id-' + i; } notSortable += '#' + this.id + ','; } }); return $('> li:not(' + notSortable + ')', settings.columns); })(); $sortableItems.find(settings.handleSelector).css({ cursor: 'move' }).mousedown(function (e) { $sortableItems.css({width:''}); $(this).parent().css({ width: $(this).parent().width() + 'px' }); }).mouseup(function () { if(!$(this).parent().hasClass('dragging')) { $(this).parent().css({width:''}); } else { $(settings.columns).sortable('disable'); } }); $(settings.columns).sortable({ items: $sortableItems, connectWith: $(settings.columns), handle: settings.handleSelector, placeholder: 'widget-placeholder', forcePlaceholderSize: true, revert: 300, delay: 100, opacity: 0.8, containment: 'document', start: function (e,ui) { $(ui.helper).addClass('dragging'); }, stop: function (e,ui) { $(ui.item).css({width:''}).removeClass('dragging'); $(settings.columns).sortable('enable'); } }); }};iNettuts.init();


inettuts.css

/* Reset */body,img,p,h1,h2,h3,h4,h5,h6,ul,ol {margin:0; padding:0; list-style:none; border:none;}/* End Reset */body {font-size:0.8em; font-family:Arial,Verdana,Sans-Serif; background: #fff;}a {color:white;}/* Colors */.color-yellow {background:#f2bc00;}.color-red    {background:#dd0000;}.color-blue   {background:#148ea4;}.color-white  {background:#dfdfdf;}.color-orange {background:#f66e00;}.color-green  {background:#8dc100;}.color-yellow h3,.color-white h3,.color-green h3    {color:#000;}.color-red h3,.color-blue h3,.color-orange h3    {color:#FFF;}/* End Colors *//* Head section */#head {    background: #fff url(img/head-bg.png) repeat-x;    height: 100px;}#head h1 {    line-height: 100px;    color: #FFF;    text-align: center;    background: url(img/inettuts.png) no-repeat center;    text-indent: -9999em}/* End Head Section *//* Columns section */#columns .column {    float: left;    width: 33.3%;        /* Min-height: */        min-height: 400px;        height: auto !important;         height: 400px;}#columns .column-dingzh {    float: left;    width: 33.3%;        /* Min-height: */        min-height: 400px;        height: auto !important;         height: 400px;}/* Column dividers (background-images) : */    #columns #column1 { background: url(img/column-bg-left.png) no-repeat right top; }    #columns #column3 { background: url(img/column-bg-right.png) no-repeat left top; }#columns #column1 .widget { margin: 30px 35px 0 25px; }#columns #column3 .widget { margin: 30px 25px 0 35px; }#columns .widget {    margin: 30px 20px 0 20px;    padding: 2px;    -moz-border-radius: 4px;    -webkit-border-radius: 4px;}#columns .widget .widget-head {    color: #fff;    overflow: hidden;    width: 100%;    height: 30px;    line-height: 30px;}#columns .widget .widget-head h3 {    padding: 0 5px;    float: left;}#columns .widget .widget-content {    background: #333 url(img/widget-content-bg.png) repeat-x;    padding: 0 5px;    color: #DDD;    -moz-border-radius-bottomleft: 2px;    -moz-border-radius-bottomright: 2px;    -webkit-border-bottom-left-radius: 2px;    -webkit-border-bottom-right-radius: 2px;    line-height: 1.2em;    overflow: hidden;}#columns .widget .widget-content p {    padding: 0.8em 0;    border-bottom: 1px solid #666;}#columns .widget .widget-content img {    float: right;    margin: 10px;    border: 1px solid #FFF;}#columns .widget .widget-content pre {    padding: 0.5em 5px;    color: #EEE;    font-size: 12px;}#columns .widget .widget-content ul {    padding: 5px 0 5px 20px;    list-style: disc;}#columns .widget .widget-content ul li {padding: 3px 0;}#columns .widget .widget-content ul.images {    padding: 7px 0 0 0;    list-style: none;    height: 1%;}#columns .widget .widget-content ul.images li {    display: inline;    float: left;}#columns .widget .widget-content ul.images img {    display: inline;    float: left;    margin: 0 0 7px 7px;}/* End Columns section */

inettuts.js.css

/* JS-Enabled CSS */.widget-head a.remove  {    float: right;    display: inline;    background: url(img/buttons.gif) no-repeat -24px 0;    width: 14px;    height: 14px;    margin: 8px 4px 8px 0;    text-indent: -9999em;    outline: none;}.widget-head a.edit  {    float: right;    display: inline;    background: url(img/buttons.gif) no-repeat;    width: 24px;    height: 14px;    text-indent: -9999em;    margin: 8px 4px 8px 4px;    outline: none;}.widget-head a.collapse  {    float: left;    display: inline;    background: url(img/buttons.gif) no-repeat -52px 0;    width: 14px;    height: 14px;    text-indent: -9999em;    margin: 8px 0 8px 4px;    outline: none;}.widget-placeholder { border: 2px dashed #999;}#column1 .widget-placeholder { margin: 30px 35px 0 25px; }#column2 .widget-placeholder { margin: 30px 20px 0 20px; }#column3 .widget-placeholder { margin: 30px 25px 0 35px; }.edit-box {    overflow: hidden;    background: #333 url(img/widget-content-bg.png) repeat-x;    margin-bottom: 2px;    padding: 10px 0;}.edit-box li.item {    padding: 10px 0;    overflow: hidden;    float: left;    width: 100%;    clear: both;}.edit-box label {    float: left;    width: 30%;    color: #FFF;    padding: 0 0 0 10px;}.edit-box ul.colors li {    width: 20px;    height: 20px;    border: 1px solid #EEE;    float: left;    display: inline;    margin: 0 5px 0 0;    cursor: pointer;}

运行结果如图:



jquery 移动到对应元素_Jquery实现拖拽可编辑模块相关推荐

  1. 可拖拽的html5页面编辑,jQuery实现拖拽可编辑模块功能代码

    在没给大家分享实现代码之前,先给大家展示下效果图: 具体实现代码如下所示: index.html iNettuts - Welcome! iNettuts 简介窗口 如果你活着,早晚都会死:如果你死了 ...

  2. draggable禁止拖动_通过 JS 实现简单的拖拽功能并且可以在特定元素上禁止拖拽...

    前言 关于讲解 JS 的拖拽功能的文章数不胜数,我确实没有必要大费周章再写一篇重复的文章来吸引眼球.本文的重点是讲解如何在某些特定的元素上禁止拖拽.这是我在编写插件时遇到的问题,其实很多插件的拖拽功能 ...

  3. jQuery实现table表格中行数据上下拖拽功能

    jQuery实现table表格中行数据上下拖拽功能 $("#table").sortable({cursor: "move",axis: "y&quo ...

  4. jquery按下标获取元素_jquery 怎么获取隐藏元素的下标

    jquery 怎么获取隐藏元素的下标 关注:103  答案:2  mip版 解决时间 2021-01-19 19:37 已解决 2021-01-19 06:13 jquery 怎么获取隐藏元素的下标 ...

  5. java se拖动插件_JQuery之拖拽插件

    Jeremy - DragDrop Test !(function($) { $.extend({//获取鼠标当前坐标mouseCoords:function(ev){if(ev.pageX||ev. ...

  6. java se拖动插件_JQuery之拖拽插件实现代码

    而很多页面效果都要用到这些位置.不得已,得练练,得记记. 下面就来说说这个基于 JQuery的简易拖拽插件吧. 按惯例,先说说拖拽的原理,以及搞这么一个东东的步骤: 那什么是拖拽呢? 看名字就知道了: ...

  7. 原生JS 实现页面元素的拖动 拖拽

    1 . 实现原理 要实现页面元素的拖动,其原理就是根据鼠标的移动实时的更改元素的left 和 top值(当然元素肯定是要做绝对定位的),那么就达到我们要的效果了呀! 鼠标的位置是可以通过 e.clie ...

  8. as3文本框的动态拖拽和编辑

    如今非常多软件都支持了编辑界面的文本拖拽和点击编辑来直接改动数值, 这样便于操作, 并且体验性也好, 抛砖引玉吧 于是就用好久没编写的as3来写了一下: 由于用的flash ide写的没有提示, 就临 ...

  9. jquery json取某个元素_JQuery前端操作JSON

    一.关于Json的数据格式 从结构上看,所有的数据最终都可以分成三种类型: 第一种类型是scalar(标量),也就是一个单独的string(字符串)或数字(numbers),比如"北京&qu ...

最新文章

  1. cv2.getStructuringElement 学习
  2. 前端登陆加密和后端解密
  3. latex 公式转图片
  4. 解决iIntelliJ IDEA中新建servlet后,报错cannot resolve symbol ‘HttpServletRequest‘的问题
  5. abap 单元格级别的操作ALV.
  6. Linux Shell编程之一循环结构
  7. 拥抱模块化Java平台:Java 10上的Apache CXF
  8. PHP | 检查字符串中是否存在特定的单词/子字符串
  9. 信息学奥赛一本通 1059:求平均年龄 | OpenJudge NOI 1.5 01
  10. Android ------ handler 异步处理消息
  11. Zookeeper-入门-安装
  12. 分享我的iOS app 开发杂谈3
  13. memcpy-avx-unaligned/strcpy_sse2_unaligned崩溃记录
  14. 2015 2020 r4烧录卡 区别_2020版药典,药用辅料被重视了!
  15. Linux-chmod
  16. 已知线段上某点与起点的距离,求该点的坐标
  17. 如何让电脑的多个蓝牙音响同时输出声音
  18. VMware虚拟机/Hyper-V在(校园网/PPPoe拨号上网)环境无法上网解决方案
  19. 用WLW离线写cnblogs博文
  20. android老人字体变大,适合老年人用的安卓手机软件 一键让Android字体变大

热门文章

  1. 《Steam平台热销VR商品》(Yanlz+Unity+XR+VR+AR+MR+SteamVR+Valve+Oculus+Vive+热销商品+排行榜+推荐商品+Top+立钻哥哥+==)
  2. 【Linux】Sed简明教程
  3. Enterprise:网站搜索 - Elastic Site Search
  4. 打油诗-生活偶尔无奈
  5. 天猫校园店一个月签约100家高校!未来要服务2000万高校人群
  6. L7 记忆概论 长期记忆和工作记忆
  7. 海康、大华、宇视拉实时流url规则总结
  8. 解决mysql存储emoji表情唯一索引报错问题
  9. 新闻采集系统python_抓取网易新闻的python代码示例
  10. 中科金财java_中科金财java开发工程师笔试题(带答案).docx