var showallcategory = { initpage : function() { /** * 显示更多属性值 */ var ddh = $("#showallcategory").height(); if (ddh > 166) { var html = "更多>>"; html = $(html); html.click(function() { var $showmore = { $showmoreobj : $(this).parent(), $showmorebtn : $(this), showmoreh : '166px', showstr : '收起>>', hidestr : '显示更多>>' }; showallcategory.showmore($showmore); var $dd = $(this).parent(); if ($(this).parent().height()==110) { $dd.css('overflow-y', 'hidden'); } else { $dd.css('overflow-y', 'overlay'); } }); $("#showallcategory").prepend(html); html.click(); }; }, showmore : function($showmore) { var height = $showmore.$showmoreobj.css('height'); if (height == $showmore.showmoreh) { $showmore.$showmorebtn.text($showmore.showstr); $showmore.$showmoreobj.css('height', 'auto'); } else { $showmore.$showmorebtn.text($showmore.hidestr); $showmore.$showmoreobj.css('height', $showmore.showmoreh); } } };