使用juery treeview 出现的点击文本不进行展开的问题

来源:互联网 发布:php 程序调用文件记录 编辑:程序博客网 时间:2024/06/06 15:48

/*
 * Treeview 1.5pre - jQuery plugin to hide and show branches of a tree
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
 * http://docs.jquery.com/Plugins/Treeview
 *
 * Copyright (c) 2007 Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.treeview.js 5759 2008-07-01 07:50:28Z joern.zaefferer $
 *
 */

使用的是上面版本的juery treeview,弄好后,发现只有点击文本前面的展开/收起图标才管用,点击文本不管用.

在juery.treeview.js中我们可以看到:

  applyClasses: function(settings, toggler) {
   // TODO use event delegation
   this.filter(":has(>ul):not(:has(>a))").find(">span").unbind("click.treeview").bind("click.treeview", function(event) {
    // don't handle click events on children, eg. checkboxes
    if ( this == event.target )
     toggler.apply($(this).next());
   }).add( $("a", this) ).hoverClass();

........................

 

写的比较明白,就是对于有ul ,但是没有a标签的 有click事件,我检查了我网页上的源代码,发现我的父菜单是有<a>标签的,

去掉就可以了.当然我们也可以改这个js,实现相关的应用

 

原创粉丝点击