//封装手风琴
/**
*
*
*
*/ $.fn.accordion = function (colors, width) { var width=width||0;
var colors= colors||[]; $li = this.find("li");
var boxWidth = this.width();
var avgWidth = boxWidth / $li.length;
var maxWidth = boxWidth - ($li.length - 1) * width; //更改li的颜色
$li.each(function (i, e) {
$(e).css("backgroundColor", colors[i]);
}); //鼠标进入事件
$li.on("mouseenter", function () {
$(this).stop().animate({
"width": maxWidth
}).siblings().stop().animate({
"width": width
});
})
//鼠标离开事件
$li.on("mouseleave", function () {
$li.stop().animate({
"width": avgWidth
});
})
return this;
}

先提供代码!有时间会更新详细的内容~~~~~~~~~~~

最新文章

  1. IOS开发札记(2015-08-20)
  2. byte数组和File,InputStream互转
  3. lintcode:First Missing Positive 丢失的第一个正整数
  4. centos下hadoop2.6.0集群搭建详细过程
  5. iOS开发 .framework的Optional(弱引用)和Required(强引用)区别, 有错误 Library not found………………
  6. C#摇奖程序
  7. USACO Section 5.4 TeleCowmunication(最小割)
  8. ThreadPoolExecutor系列<二、ThreadPoolExecutor 代码流程图>
  9. consul如何限制注册的ip
  10. LeetCode——162. Find Peak Element
  11. The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.
  12. 将本地项目上传到git
  13. 使用pytorch完成kaggle猫狗图像识别
  14. MyBatis开发Dao层的两种方式(原始Dao层开发)
  15. mybatis学习之路----批量更新数据两种方法效率对比
  16. MongoDB基本管理命令 [转]
  17. math.random用法
  18. leetcode644. Maximum Average Subarray II
  19. Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=11.0.0.0 异常处理
  20. Mahout介绍-炼数

热门文章

  1. Linux内核基本装载卸载
  2. rpm --rebuilddb
  3. javascript之原型链
  4. h5页面关于复制某段文字
  5. Codeforces 1120 简要题解
  6. 环境搭建文档——Windows下的Git搭建详解
  7. nice coding (与其亡羊补牢,不如未雨绸缪)
  8. kubernetes CRD学习笔记
  9. Minimum setup for Apache+AD SSO
  10. PyCharm远程开发和调试