npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jquery-simpletree

v0.1.1

Published

jQuery plugin for TreeView support.

Downloads

6

Readme

jQuery simpleTree

Yet another jQuery treeview plugin to display nested ULs as nice trees.

This plugin is based on a script and CSS for simple unobtrusive javascript treeview developed by Krijn Hoetmer:

http://krijnhoetmer.nl/stuff/javascript/list-treeview-menu/

Adapted as a jQuery plugin by Maurizio Manetti.

Live demo and examples: https://mauntrelio.github.io/demos/simpletree/

Installation:

To be documented. You can figure out...

Usage:

Include files from the dist folder:

	<!-- Simple Tree core CSS file -->
	<link rel="stylesheet" href="css/simpletree.css">

	<!-- jQuery 1.9+ or Zepto.js 1.0+ -->
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

	<!-- Simple Tree core JS file -->
	<script src="js/jquery.simpletree.min.js"></script>

Treeview initialization should be executed after document ready, for example:

	$(document).ready(function() {
	  $('.tree').simpleTree({startCollapsed: false});
	});

The option startCollapsed is true by default.

Treeview can be applied programmatically:

	$('#maketree').on('click',function(){
		$('#firstTree').simpleTree();
	});	

Treeview can be removed:

	$('#destroytree').on('click',function(){
		$('#firstTree').simpleTree('destroy');
	});	

Please note that simpleTree is stateful: expanded and collapsed status of the nodes will be kept if you destroy and then re-apply treeview again. This is based on simpleTree specific classes (.st-open and .st-collapsed) defined in the CSS.

This is also useful if you want to have a treeview partially opened by default: just give the class .st-open or .st-collapsed to the relevant List Item. Class given on the single LI element take precedence over the global startCollapsed option.

Treeview provides three basic methods in addition to destroy. Use the expand method to fully open a treeview:

	$('#firstTree').simpleTree('expand');

Use the collapse method to completely close a treeview:

	$('#firstTree').simpleTree('collapse');

If you need to dynamically add or remove elements to your list when the treeview is applied and you want to keep consistency, just call the repaint method immediately after adding or removing the element:

	$('#firstTree').append('<li>Added item</li>');
	$('#firstTree').simpleTree('repaint');

Live demo and examples: https://mauntrelio.github.io/demos/simpletree/

Alternatives:

There are plenties

  • https://plugins.jquery.com/?s=treeview
  • https://github.com/caerphoto/simpletreeview
  • https://github.com/mar10/fancytree
  • http://mbraak.github.io/jqTree/
  • https://github.com/phoenixinobi/simpletree
  • https://github.com/innoq/simpletree

TODO:

  • document installation
  • themes (different icons / look)