From 05bc47a5ef8a97ffb82c47991f2d80901676276b Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Mon, 19 Dec 2011 02:34:47 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E6=A0=91=E5=BD=A2?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/js/jquery.tree.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/js/jquery.tree.js b/htdocs/js/jquery.tree.js index df3affb1..d28ab0f7 100644 --- a/htdocs/js/jquery.tree.js +++ b/htdocs/js/jquery.tree.js @@ -3,6 +3,7 @@ $.fn.tree = function(options) { var defualts = { + 'class':'.expandable', 'toggle':'.tree-toggle-btn', 'downImg':'/images/plus.gif', 'upImg':'/images/minus.gif' @@ -15,7 +16,12 @@ this.each(function() { $(this).children('.expandable').each(function (){ $(this).children('.tree-toggle-btn').bind('click', function() { - $(this).parent().children('ul').slideToggle("slow"); + $(this).parent().children('ul').slideToggle("slow",function(){ + if($(this).css('display')=='none') + $(this).parent(opts.class).find(opts.toggle).find("img").attr('src',opts.downImg); + else + $(this).parent(opts.class).find(opts.toggle).find("img").attr('src',opts.upImg); + }); }); }); });