直接调用一个accordion函数就Ok!
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Accordion - Default functionality</title>
<link type="text/css" href="theme/uiallcss" rel="stylesheet" />
<script type="text/javascript" src="jquery-132js"></script>
<script type="text/javascript" src="ui/uicorejs"></script>
<script type="text/javascript" src="ui/uiaccordionjs"></script>
<script type="text/javascript">
$(function() {
$("#accordion")accordion();
});
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam Integer
ut neque Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc Nam a nibh Donec suscipit eros Nam mi Proin viverra leo ut
odio Curabitur malesuada Vestibulum a velit eu ante scelerisque vulputate
</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>
Sed non urna Donec et ante Phasellus eu ligula Vestibulum sit amet
purus Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo Vivamus non quam In
suscipit faucibus urna
</p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus Quisque lobortis
Phasellus pellentesque purus in massa Aenean in pede Phasellus ac libero
ac tellus pellentesque semper Sed ac felis Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui
</p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>
Cras dictum Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est
</p>
<p>
Suspendisse eu nisl Nullam ut libero Integer dignissim consequat lectus
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos
</p>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>
Click headers to expand/collapse content that is broken into logical sections, much like tabs
Optionally, toggle sections open/closed on mouseover
</p>
<p>
The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is
usable without JavaScript
</p>
</div><!-- End demo-description -->
</body>
</html>
可以的。
看到非常流畅的slide动画效果。
相比之前模拟动画demo,这里多了这么行CSS代码:
container {
transition: height 06s;
}
然后,JS代码就基本上全部消灭了,只留下改变高度的几行代码:
var display = false;
buttononclick = function() {
display = !display;
containerstyleheight = display "192px": "0px"
return false;
};
})();
这是我自己用的jquery,很好理解,看下应该就明白,目前所测试的浏览器都兼容,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 10 Transitional//EN" "http://wwww3org/TR/xhtml1/DTD/xhtml1-transitionaldtd">
<html xmlns="http://wwww3org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="http://ajaxgoogleapiscom/ajax/libs/jquery/130/jqueryminjs"></script>
</head>
<body>
<div id="click" style="line-height:40px; height:40px; width:120px; background:#0cf; text-align:center">点击这里</div>
<div id="target" style="margin-top:1000px; height:200px; padding-bottom:1000px; background:#00f"></div>
<script type="text/javascript">
$(document)ready(function(){
$extend({
'goAnchor':function(to, time){
$obj = (windowopera)(documentcompatMode=="CSS1Compat"$('html'):$('body')):$('html,body');
$($obj)animate({scrollTop:to}, time);
}
});
//
$('#click')click(function(){
$goAnchor($('#target')offset()top, 1000);
});
});
</script>
</body>
</html>
这篇文章介绍了几种JS的动态效果实例 有需要的朋友可以参考一下 复制代码 代码如下: <!DOCTYPE PUBLIC " //W C//DTD HTML Transitional//EN" " <> <head> <meta equiv="Content Type" content="text/; charset=UTF "> <title>浮动</title> <script type=text/javascript> var step = ; // 移动的像素 var y = ; // 垂直移动的方向 表示向上 表示向下 var x = ; // 水平移动的方向 表示向左 表示向右 function myFloat() { var img = document getElementById("myImg"); // 获取和当前浏览器窗口上边距 由于img style top获取的值带px单位 var top = img style top replace("px" ""); // top = top ; // img style top = top + "px"; // 获取和当前浏览器窗口左边距 var left = img style left replace("px" ""); // left = left ; // img style left = left + "px"; // 上下移动 if(top <= ) { y = ; } if(top >= document body clientHeight) { y = ; } top = (top ) + (step y); img style top = top + "px"; // 左右移动 if(left <= ) { x = ; } // alert(img clientWidth); if(left >= (document body clientWidth img clientWidth)) { x = ; } left = (left ) + (step x); img style left = left + "px"; setTimeout("myFloat()" ); } </script> </head> <body onload="myFloat();" > <img id="myImg" src=" /> </body> </>
另一种的实现方式
复制代码 代码如下: <> <head> <meta equiv="Content Type" content="text/; charset=gb " /> <title>浮动广告实例</title> <script type=text/javascript> var pos = ; function toueme() { document getElementById("toubiao") style display = "none"; } function initArray() { this length = initArray arguments length; for (var i = ; i < this length; i++) { this[i] = initArray arguments[i]; } } var col = new initArray(" b" " b" " b" " b"); col[ ] = "yellow"; col[ ] = "coral"; col[ ] = "orange"; col[ ] = "red"; col[ ] = "greenyellow"; col[ ] = "lime"; col[ ] = "turquoise"; col[ ] = "coral"; col[ ] = "blueviolet"; col[ ] = "violet"; function chgCol() { pos++; if (pos < || pos > ) { pos = ; } document bgColor = col[pos]; setTimeout("chgCol()" ); } </script> </head> <body bgColor="#ffffff" onload="chgCol();pingpong();"> <DIV id=img > <div id=toubiao> <a onClick=toueme()> <img src=close gif width= height= hspace=" " border= ></a> </div> <a href="#" target="_blank"> <img src= jpg width= height= border= > </a> </DIV> <SCRIPT> var xPos = ; var yPos = ; var step = ; var delay = ; var height = ; var Hoffset = ; var Woffset = ; var yon = ; var xon = ; var pause = true; var interval; img style top = yPos; function changePos() { width = document body clientWidth; //获取浏览器的宽度 height = document body clientHeight; //获取浏览器的高度 Hoffset = img offsetHeight; Woffset = img offsetWidth; img style left = xPos + document body scrollLeft; img style top = yPos + document body scrollTop; if (yon) {yPos = yPos + step;} else {yPos = yPos step;} if (yPos < ) {yon = ;yPos = ;} if (yPos >= (height Hoffset)) {yon = ;yPos = (height Hoffset);} if (xon) {xPos = xPos + step;} else {xPos = xPos step;} if (xPos < ) {xon = ;xPos = ;} if (xPos >= (width Woffset)) {xon = ;xPos = (width Woffset); } } function start() { img visibility = "visible"; interval = setInterval( changePos() delay); //interval = setTimeout("changePos()" delay); } function pause_resume() { if(pause) { clearInterval(interval); pause = false;} else { interval = setInterval( changePos() delay); pause = true; } } start(); </SCRIPT> </body> </>JS实现气泡从水中急速上升效果
复制代码 代码如下: <> <head> <title>JS实现气泡从水中急速上升效果</title> <style type=text/css> body {cursor:crosshair;margin: ; padding: ; position:absolute; overflow:hidden; background:#FFF; left: ; top: ; width: %; height: %;} </style> <script type=text/javascript> var object = new Array(); nbfm = ; var xm = ; var ym = ; var nx = ; var ny = ; function movbulb(){ with (this) { if(ec < ){ if(Math abs(x xm) < && Math abs(y ym) < ){ xx = (xm x ) / ; yy = (ym y ) / ; ec++; } } xx = ; yy = ; x = Math round(x + Math cos(y / ) p) + xx; y += yy v; if(y < h || x < w || x > nx + w ){ y = ny + N + h ; x = nx/ + Math random() ; ec = ; } obj style top = y h; obj style left = x w; } } function CObj(N img w h){ this obj = document createElement("img"); this obj src = img src; this obj style position = "absolute"; this obj style left = ; document body appendChild(this obj); this N = N; this x = ; this y = ; this v = + Math round(( / h) Math random()); this p = + Math round((w / ) Math random()); this xx = ; this yy = ; this ec = ; this w = w; this h = h; this movbulb = movbulb; } function resize(){ nx = document body offsetWidth; ny = document body offsetHeight; } onresize = resize; document onmousemove = function(e){ if (window event) e = window event; xm = document body scrollLeft+(e x || e clientX); ym = document body scrollTop+(e y || e clientY); } function run(){ for(i in object)object[i] movbulb(); setTimeout(run ); } onload = function() { PIC = document getElementById("bubbles") getElementsByTagName("img"); resize(); for(nbf= ;nbf<nbfm;nbf++){ sf = PIC[nbf%PIC length]; object[nbf] = new CObj(nbf sf sf width/ sf height/ ); } run(); } </script> </head> <body> <div id="bubbles" class="page_speeder_704484182"> <img src= ile gif> <img src=biggrin gif> <img src=eek gif> <img src=rolleyes gif> </div> </body> </>浮动广告
复制代码 代码如下: lishixinzhi/Article/program/Java/JSP/201311/20253
最近做了一个PC站首页demo,为了让页面不至于太死板,在背景上给一些模块加入了这种粒子效果,
移动端demo: https://lavendergirlgithubio/particles/mobile-indexhtml
PC端demo: https://lavendergirlgithubio/particles/indexhtml
线上test: https://codepenio/VincentGarreau/pen/pnlso
如果需要看源码实现可以在github上看看: https://githubcom/lavenderGirl/particles
具体实现:
配置可参考: https://wwwcnblogscom/wangyihong/p/8618305html
当然也可直接看 https://githubcom/VincentGarreau/particlesjs
通过不同的配置可以实现很多不一样的效果哦。动手去试试吧。
没做这个之前,都不知道这叫什么,只知道有时候会在一些网站上看到,也没太注意,真正想要用的时候,不知道去搜什么,所在在找的过程中也花了一点时间,如果你也需要这种效果,那么这篇文章适合你看看哦。
不是每一次努力都有收获,但是,每一次收获都必须努力。加油。
<script language="javascript">
function calculate(){
n=documentgetElementById("in")value
sum=0
for(i=1;i<=n;i++){
sum+=i
}
documentgetElementById("result")innerHTML="结果 = "+sum
}
</script>
n=<input type="text" id="in"><br>
<input type="button" value="计算" onclick="calculate()"><span id="result"></span>
原文:https://wwwzhihucom/question
1程序员表白代码_专用_三行等8种表白代码
2类似于 Trojan 五分钟 Hack 一部 Android 手机,这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面)
3Microsoft 和 GitHub 的结合体。众所周知,GitHub 已被微软收购,在收购消息爆出的同时,就出现了很多恶搞的笑话和。但是今天分享的这个就不一样,很有意思。
MicroHub 是一个微软主题风格的 Chrome 插件,让你的 GitHub 界面变成微软的经典风格。
(github上有很多好玩的程序,好用的资源教程等等,可以多去浏览学习)
4PullToRefreshjs
upload-labs 是一个帮你总结所有类型的上传漏洞的靶场。它是一个用 PHP 语言编写的,专门收集渗透测试过程中遇到的各种上传漏洞的靶场。旨在帮助大家对上传漏洞有一个全面的了解。目前一共 19 关,每一关都包含着不同的上传方式。
html
复制代码代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>apple button</title>
</head>
<body>
<div id="div1">
<div id="div2"></div>
</div>
</body>
</html>
css
复制代码代码如下:
#div1{
width: 170px;
height: 100px;
border-radius: 50px;
position: relative;
}
#div2{
width: 96px;
height: 96px;
border-radius: 48px;
position: absolute;
background: white;
box-shadow: 0px 2px 4px rgba(0,0,0,04);
}
open1{
background: rgba(0,184,0,08);
}
open2{
top: 2px;
right: 1px;
}
close1{
background: rgba(255,255,255,04);
border:3px solid rgba(0,0,0,015);
border-left: transparent;
}
close2{
left: 0px;
top: 0px;
border:2px solid rgba(0,0,0,01);
}
javascript
复制代码代码如下:
windowonload=function(){
var div2=documentgetElementById("div2");
var div1=documentgetElementById("div1");
div2onclick=function(){
div1className=(div1className=="close1")"open1":"close1";
div2className=(div2className=="close2")"open2":"close2";
}
}
欢迎分享,转载请注明来源:表白网
评论列表(0条)