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); } } };