超级简单的手风琴效果
来源:互联网 发布:bluetooth网络连接设置 编辑:程序博客网 时间:2024/05/22 10:47
<!DOCTYPE><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>测试</title> <script type="text/javascript" src="images/jquery.js"></script> <link rel="stylesheet" href="images/index.css"></head><body><div class="top"><li><span>书签切换系列</span><p>-</p><div class="main"></div></li><li><span>书签切换系列</span><p>-</p><div class="main"></div></li><li><span>书签切换系列</span><p>-</p><div class="main"></div></li></div> <script type="text/javascript" src="images/index.js"></script></body></html>
*{ margin:0; padding:0;}body{background-color: pink;}li{list-style: none;}.top{width: 450px;height: 35px;}.top li{background-color:yellow;border-top:1px solid gray;}.top span{font-size: 14px;line-height: 35px;margin:0 0 0 10px;}.top p{float: right;text-align: center;line-height: 35px;margin-right: 10px;}.top .main{width: 450px;height: 230px;background-color: green;display:none;}
$(function(){var top=$('.top');var li=$('li');var span=$('span');function play(n){li.eq(n).children('p').text("+").end().siblings().children('p').text("-");//用end结束返回li如何再从li的其他元素的子元素进行操作li.eq(n).children('.main').slideDown(200).end().siblings().children('.main').slideUp(200);} li.mouseenter(function(){ n=li.index($(this)); play(n); }); })
以为是个很简单的效果,没想到花了70分钟左右,主要是在开始一直在同一个li下的元素里操作,而不是不同的元素里。导致一直会显示而不会隐藏。
要在一个li的元素操作完了以后再用end结束使用另外的li元素操作。不用end的话查找其他元素会很麻烦
阅读全文
0 0
- 超级简单的手风琴效果
- 一个简单的手风琴效果
- 一个最简单的jQuery手风琴效果
- JQuery基础练习:简单的手风琴效果
- 简单的手风琴JS效果实现
- jquery简单手风琴效果
- 手风琴切换的效果
- 最简单的手风琴效果 —— 无动画
- 用ReactJs写一个简单的手风琴菜单效果
- jquery插件手风琴的效果
- Accordion手风琴式的效果
- css制作手风琴的效果
- css3实现的手风琴效果
- 下拉菜单的手风琴效果
- 手风琴效果(超简单实用)
- FLASH手写效果超级简单的方法
- 手风琴效果
- 手风琴效果
- ChartDirector 6.0在MFC下乱码问题
- 2017-12-19 MOTS
- 关系运算符---(~=译为不等于)
- C# int与string转化
- Mysql中查看每个IP的连接数
- 超级简单的手风琴效果
- node.js环境安装,及连接mongodb测试
- 求高精度幂(poj 1001)
- 十周第二次课 2017.12.19 Apache和PHP结合、Apache默认虚拟主机
- byte数组在异步环境下拼接为string---使用System.Text.Encoder
- Ubuntu下的NFS服务配置总结
- 模板基础知识3——《C++程序设计语言(第四版)》第25章 特例化 笔记
- 为项目添加广告
- shape简单绘制圆形背景