// left tree (function(win, $) { $('.wb-tree').on('click', '.wb-tree-node', function(event) { var $this = $(this).parent(); if ($this.hasclass('haschild')) { if (event.target.classname != 'wb-tree-tt') { $("li.haschild").each(function(index, element) { if (!$(this).is($this)) { $(this).removeclass('current'); $(this).find('.wb-tree-item').removeclass('current'); } }); $this.toggleclass('current'); } } }); $('.wb-tree-sub .wb-three-node').on('click', function(event) { var $this = $(this).parent('.wb-tree-item'); if (event.target.classname != 'wb-three-tt') { if( $this.hasclass('current')){ $this.parent().find('.wb-tree-item').removeclass('current'); }else{ $this.parent().find('.wb-tree-item').removeclass('current'); $this.addclass('current'); } } }); }(this, jquery));