下拉菜单的CSS与Javascript(或库js) [英] CSS vs. Javascript (or library js) for DropDown Menus

查看:82
本文介绍了下拉菜单的CSS与Javascript(或库js)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将要开始一个需要下拉菜单的项目-基本上,它将由类别组成,并且在这些类别内-子类别将有一个附加的下拉菜单. ALA.

I am about to start a project that will require dropdown menus - Basically, it will consist of categories and within those categories - there will be an additional dropdown for subcategories. ALA.

MENU
---> Colors
---> Sizes --> Large
---> Makes     Medium

每只猫可以"有一个子菜单.

each of the cats "could" have a submenu.

我的问题是仅CSS3菜单的出现-与传统的JS创建的菜单相比,它们有什么优势?我知道有很多jQuery菜单以及CSS3,我很好奇,这是现在更健壮/可维护的解决方案吗?

My question is about the advent of the CSS3 only menus - and what advantages if any do they have over conventional JS created ones. I know there are a bunch of jQuery menus as well as CSS3 -- I am curious, which is the more robust/maintanable solution now?

CSS3与jQuery(或任何js解决方案)之间的菜单创建?

CSS3 vs. jQuery( or any js solution) for menu creation?

推荐答案

  1. 您可以创建下拉菜单,而无需使用任何CSS3特定属性.
  2. 除非您需要动画或实际上需要jQuery或javascript然后再坚持使用CSS的东西.

为什么?

您的用户可能会在浏览器上关闭javascript,尽管这不太可能,这意味着他们不会按预期的方式查看菜单,普通用户无法禁用CSS(是的,可以与网络开发人员一起添加).您还将包括一个不需要的全部库和脚本.

It is possible, although unlikely, that your user has javascript turned off on their browser meaning they won't see your menu the way it's intended, there is no way for a normal user to disable CSS (yes it can be done with web developer add ons). You're also including an entire library and scripting for something that just doesn't require it.

您解释的内容根本不需要jQuery或javascript,那么为什么要麻烦使用它呢?

What you explained doesn't require jQuery or javascript at all so why bother using it?

这篇关于下拉菜单的CSS与Javascript(或库js)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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