代码如下: JS+CSS制作的DIV层最小化和随意拖拽排序功能 body { margin:10px; } #dragHelper { position:absolute;/*重要*/ border:2px dashed #000000; background-color:#FFFFFF; filter: alpha(opacity=30); } .normal { position:absolute;/*重要*/ width:300px; #height:10px; border:1px solid #666666; background-color:#FFFFFF; } .over { position:absolute;/*重要*/ width:300px; #height:10px; border:1px solid #66...
实现思路: 1、ztree中节点是通过一个json的Array作为数据源、,所以直接操作json字符串,然后转为json对象数组。 2、然后用新构成的json数组对象重新初始化ztree对象。代码如下: var zTreeObj1; var zTreeObj2; var leftDivStr = "["; var rightDivStr = "["; var setting = { edit: { enable: false, showRemoveBtn: false, showRe...
DIV+CSS+JS实现不间断横向滚动代码 代码如下: 横向不间断滚动DIV CSS代码-DIVCSS5 .scroll_div {width:600px; height:49px;margin:0 auto; overflow: hidden; white-space: nowrap; background:#ffffff;} .scroll_div img {width:120px;height:49px;border: 0;margin: auto 8px; } #scroll_begin, #scroll_end, #scroll_begin ul, #scroll_end ul, #scroll_begin ul li, #scroll_end ul li{display:inline;}/* 设置ul和li横...
在使用DIV和CSS进行网页布局中,DIV的自适应高度和自适应宽度是一个很常见的问题。 为了保证页面的整体美观性,需要将两个或者多个层的高度/宽度保持一致。左右自适应高度一致 Jquery 代码如下: 135 2 $(function(){ var heightLeft= $("#Left").height(); var heightRight= $("#Right").height(); if (heightLeft > heightRight) { $("#Right").height(heightLeft); } else { $("#Left").height(heightRight); } }) DIV高度...
代码如下: .content { border: 1px solid #ccc; width: 440px; overflow: hidden; margin: 10px; } $(document).ready(function() { if ($('#content').height() > 400) $('#content').height(400); $('#bigger').toggle(function() { $('#content').height($('#content').height() + 100); $('#bigger').html('缩小'); }, function() { $('#content').height($('#content').height() - 100); $('#bigger').html('放大'); }...
代码如下: .content{width:500px;height:300px;position:absolute;left:200px;top:100px;border:solid 2px red;padding:10px;overflow:hidden} dl{width:400px;height:30px;border:1px solid black;} 测试数据1 测试数据2 测试数据3 测试数据4 测试数据5 测试数据6 测试数据7 测试数据8 测试数据9 测试数据10 $(function(){ $('.content dl').hide(); $('.content dl:gt('+($('.content dl').length - 5...
有一段时间没更新博客了,都不知道忙些什么,学习也没什么进展,惭愧。 这一周空闲的时间学着自己写一下JQ插件。以前用原生的JS做过类似拖拽div的效果,现在按原思路改做成一个JQ的小插件,当作制作JQ插件的一个小练习。 html为 代码如下: *{margin:0;padding:0;} #box{width:500px;height:500px;margin:200px auto;position:relative;border:1px solid #ccc;border-left:2px solid #ccc;} .float-box{width:100px;height:1...
看到群里有人提了一个问题,说文字溢出,如何实现溢出的文字放入一个新生成的div中, 想了一下原理,就是判断是否能在div里放下,如果不能,则在应该断开的地方,差入到新的div中,代码如下: 代码如下: 文字自动分插不同的div-Jason Yu *{margin:0;padding:0;} body{line-height:24px;font-family:SimSun;font-size:12px;color:#000;} #box1{height:96px;} .box{width:200px;overflow:hidden;margin-top:10px;border:1px so...
本示例使用Javascript实现了滚动页面时,DIV到达顶部时固定在顶部。在IE下效果有点闪,效果网址:http://www.keleyi.com/keleyi/phtml/fixdiv.htm 下面是代码: 代码如下: href="http://www.keleyi.com/menu/net/" target="_blank">.NET Javascript jQuery C# 其他 首页 $(function () { var ie6 = document.all; var dv = $('#fixedMenu_keleyi_com'), st; dv.attr('otop', dv.offset().top); //存储原来的距离顶部的距离 ...
jQuery实现Tab切换 接触jQ不久以前的js代码来写的简单效果现在用jQ来写: HTML代码: 代码如下: 最新评论近期热评随机文章 1234567890-1 1234567890-2 1234567890-3 css代码: 代码如下: #sidebar-tab{border:1px solid #ccf;margin-bottom:1.5em;overflow:hidden;} #tab-title h3{color:#666;font-size:15px;font-weight:400;} #tab-title .selected{color:#356aa0;border-bottom:0px;} /*标题被选中时的样式*/ #tab-tit...
纠结了两天,憋出了个蛋,欢迎拍砖!!! 代码如下: 无标题文档 ul{margin:0;padding:0} li{position:relative;margin:0;padding:0;;} .grid{background:#ccc;width:100px;height:100px;;} .f{background:#333;width:200px;height:200px;position:absolute;top:0;left:100px; display:none} jQuery(function(){ window.a=0; window.b=1 ; //同为1隐藏弹层 $('ul').delegate('.grid','mouseover',function(){ // 鼠标放在头...
一些简单的例子,用原生js和jQuery实现随意改变div属性,和重置。代码如下: 代码如下: 函数传参,改变Div任意属性的值 body,p{margin:0;padding:0;} body{color:#333;font:12px/1.5 Tahoma;padding-top:10px;} #outer{width:300px;margin:0 auto;} p{margin-bottom:10px;} button{margin-right:5px;} label{width:5em;display:inline-block;text-align:right;} input{padding:3px;font-family:inherit;border:1px solid #cc...
代码如下: $("#feedbackContainer").scrollTop($("#feedbackContainer").height());
在使用Java做后台的时候,都会做到登录的页面,但是自己的页面太难看了,要居中没居中,要颜色没颜色,但是无论是怎么样都得使登录的框居中吧!以前的想法是通过CSS+Div使div居中,但是现在的想法变了,通过JavaScript可以简单的使Div在页面上居中,随着网页大小的改变做出相应的改变。而且只要明白了居中的原理轻而易举的就可以实现了。 先看一下居中的原理吧! 先看一张图。 从图中看到了什么?可以看到红色的框居中了,为什么会...
代码如下:oec2003function toggle(targetid){ if (document.getElementById){ target=document.getElementById(targetid); if (target.style.display=="block"){ target.style.display="none"; } else { target.style.display="block"; } }}#div1{background-color:#000000;height:400px;width:400px;display:none;} 居中的DIV JavaSc...