更新了树形菜单功能
This commit is contained in:
parent
e7f0e28563
commit
05bc47a5ef
|
@ -3,6 +3,7 @@
|
||||||
$.fn.tree = function(options) {
|
$.fn.tree = function(options) {
|
||||||
|
|
||||||
var defualts = {
|
var defualts = {
|
||||||
|
'class':'.expandable',
|
||||||
'toggle':'.tree-toggle-btn',
|
'toggle':'.tree-toggle-btn',
|
||||||
'downImg':'/images/plus.gif',
|
'downImg':'/images/plus.gif',
|
||||||
'upImg':'/images/minus.gif'
|
'upImg':'/images/minus.gif'
|
||||||
|
@ -15,7 +16,12 @@
|
||||||
this.each(function() {
|
this.each(function() {
|
||||||
$(this).children('.expandable').each(function (){
|
$(this).children('.expandable').each(function (){
|
||||||
$(this).children('.tree-toggle-btn').bind('click', 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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue