如何通过css&创建树视图JS [英] How to create treeview through css & js

查看:91
本文介绍了如何通过css&创建树视图JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际的树一般我们在我们的数据结构书中....

与我共享css链接

the actual tree generally we that in our data structure book....
share css link with me

推荐答案

你可以使用 li ul 标签创建树视图。

对于中的点击功能 a 标签li 如果需要
You can create a treeview using li and ul tags.
And for the click function a tag inside the li if needed


CSS单独做不到,可能会有很多孩子,他们不会为N个元素编写CSS子选择器,是吗?出于这个原因,JavaScript用于为这些N个元素创建一个循环,并附加一个可视化表示(或一个类到每个元素)。这样,第一个元素是父元素,后来的元素只是文件或子文件夹等等。



有很多图书馆已在网上提供,谷歌的 treeview jquery [ ^ ]。您将获得20多个插件供您选择。 jsTree [ ^ ]就是其中之一。
CSS alone cannot do that, there may be a lot of childs, who are not going to write a CSS child selector for N elements, are you? For this reason JavaScript is used to create a loop for those N elements, and to attach a visual representation (or a class to each of those elements). This way, the first element is parent then later ones are simply files or child folders and so on.

There are many libraries already provided online, Google for treeview jquery[^]. You will get more than 20 plugins to chose from. jsTree[^] is one of them.


对于N个元素,循环必须用ul和li
For N elements a loop has to made with ul and li


这篇关于如何通过css&创建树视图JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆