js展开更多
var introduces = {
inIt : function(){
introduces.imgLoad();
introduces.showMore(0,'hioh',86);
introduces.showMore(1,'hiohs',147);
$("#normal span").hover(
function(){
$(this).addClass('cur');
},
function(){
$(this).removeClass('cur');
}
);
},
imgLoad : function(){
var mw = 500,
mh = 500,
gw = function(w,h){
return Math.round(w/h*mh);
},
gh = function(w,h){
return Math.round(h/w*mw);
},
hary = [],
imgs = $("#temp4 img");
$("#temp4 img").each(function(){
var w = $(this).width(),
h = $(this).height();
if(w > mw){
$(this).css({'width':mw,'height':gh(w,h)});
}
if(h > mh){
$(this).css({'width':gw(w,h),'height':mh});
}
hary.push($(this).height());
});
var ht = Math.max.apply(Math,hary);
$('.wrap').css({'height':ht,'line-height':ht+'px'});
},
showMore : function(unms,classname,conh){
var con = $("#con"+unms),
h = con.height(),
parent = con.parent();
if(h > conh){
parent.after('<div class="wmore"><span class="mores" id="mores'+unms+'">展开更多</span>');
}else{
parent.removeClass(classname);
}
$("#mores"+unms).click(function(){
if($(this).hasClass('moress')){
$(this).removeClass('moress');
$(this).text('展开更多');
$(this).parent().prev().addClass(classname);
}else{
$(this).addClass('moress');
$(this).text('收起');
$(this).parent().prev().removeClass(classname);
}
});
}
};
introduces.inIt();
js展开更多的更多相关文章
- ExpandableListView实现展开更多和收起更多
[需求]: 如上面图示 当点开某个一级菜单的时候,其他菜单收起: 子级菜单默认最多5个: 多于5个的显示"展开更多" 点击"展开更多",展开该级所有子级菜单,同 ...
- cell左右滑动展开更多按钮-MGSwipeTableCell
MGSwipeTableCell是一个UITableViewCell的子类, 它实现了左,右滑动展开更多按钮用来实现一些相关操作就和QQ好友列表滑动展开的按钮一样,封装的很好,动画效果也处理很到位,废 ...
- js 展开&收缩 二种
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js展开一颗树
Tree View 指令不支持 树结构数据源, 只支持单层数组.(也许是我没发现,人家可以设置) .我只能把树展开,变成单层数组.然后还要记录已经递归到第一层了.比如这样. <!doctype ...
- js 展开/收起效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 原生态js展开高度自适应100%
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 原生态js展开收缩
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js展开循环
当要对一个大数组进行循环时,通常会通过局部变量缓存数组长度来提高性能,例: for(var i=0,len=arr.len;i<len;i++){} 光是缓存数组长度或使用倒序遍历来减少判断外, ...
- [js]展开运算符
function f(...args){ console.log(args); } f(1,2,3,4,5) [...args] = [1,2,3,4] function f(...args){ co ...
随机推荐
- WPF_X命名空间
x名称空间映射的是http://schemas.microsoft.com/winfx/2006/xaml,也称为"XAML名称空间"
- IP地址,子网掩码划分(转)
IP地址划分教程 IP和子网掩码我们都知道,IP是由四段数字组成,在此,我们先来了解一下3类常用的IP A类IP段 0.0.0.0 到127.255.255.255 B类IP段 128.0.0.0 到 ...
- Microsoft JScript 运行时错误: Sys.WebForms.PageRequestManagerParserErrorException无法分析从服务器收到的消息。之所以出现此错误,
Microsoft JScript 运行时错误: Sys.WebForms.PageRequestManagerParserErrorException: 无法分析从服务器收到的消息.之所以出现此错误 ...
- ArcEngine 直连连接SDE
关键代码IPropertySet pPropertySet = new PropertySetClass(); pPropertySet.SetProperty("S ...
- 【转】图解SQL的各种连接join
原帖地址:http://www.nowamagic.net/librarys/veda/detail/936 图解SQL的各种连接join 让你对SQL的连接一目了然 在 2011年12月22日 那天 ...
- DOM4j--write
import java.io.File; import java.io.FileNotFoundException;import java.io.FileOutputStream;import jav ...
- Hdu 1042 N! (高精度数)
Problem Description Givenan integer N(0 ≤ N ≤ 10000), your task is to calculate N! Input OneN in one ...
- Openjudge/Poj 1183 反正切函数的应用
1.链接地址: http://bailian.openjudge.cn/practice/1183 http://poj.org/problem?id=1183 2.题目: 总时间限制: 1000ms ...
- ubuntu12.10可用更新源
ubutnu12.10自带的更新源已经失效,国内各大服务器的更新源,无论是网易.搜狐还是教育网的因此也失效了.附件是ubuntu12.10目前的可用更新源. 将地址中的“us.archive”换成“o ...
- Python3 正则表达式
字符串是编程时涉及到的最多的一种数据结构,对字符串进行操作的需求几乎无处不在.比如判断一个字符串是否是合法的Email地址,虽然可以编程提取@前后的子串,再分别判断是否是单词和域名,但这样做不但麻烦, ...