twitter-bootstrap 如何使用 twitter bootstrap 创建“选择语言下拉菜单”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13708083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 15:50:53  来源:igfitidea点击:

How to create a "chose language drop down menu" using twitter bootstrap?

twitter-bootstrap

提问by StenW

I am working on a project where I am using the excellent twitter bootstrap as a basis. Now I want to create a menu item where the visitor can choose what language the site should be displayed in. This has was not as easy as first expected and I wonder how I do the following.

我正在做一个项目,在该项目中我使用了优秀的 twitter bootstrap 作为基础。现在我想创建一个菜单项,访问者可以在其中选择站点应显示的语言。这并不像最初预期的那么容易,我想知道我如何执行以下操作。

  1. Make the drop down menu item float to the right.
  2. Include a small flag on the individual li items.
  3. Make the active language show on the menu, meaning depending on which li item is active it should be in the menu.
  1. 使下拉菜单项向右浮动。
  2. 在各个 li 项目上包括一个小标志。
  3. 使活动语言显示在菜单上,这意味着根据哪个 li 项目处于活动状态,它应该在菜单中。

in the menu.

在菜单中。

All help is appreciated.

感谢所有帮助。

/Sten

/斯坦

采纳答案by StenW

  1. To make the drop down menu float to the right add [ul class="nav pull-right"], this works on all menu items. Add it before the drop down.
  2. I found the flag icons and a tutorial on how to integrate new css sprite icons in Twitter Bootstrap. It explains in a more comprehensive manner than I can, so I would suggest to follow the link.
  1. 要使下拉菜单向右浮动,请添加 [ul class="nav pull-right"],这适用于所有菜单项。在下拉之前添加它。
  2. 我找到了标志图标和关于如何在 Twitter Bootstrap 中集成新的 css sprite 图标的教程。它以比我更全面的方式解释,所以我建议点击链接。

http://favbulous.com/post/1006/create-custom-icons-for-twitter-bootstrap-easily

http://favbulous.com/post/1006/create-custom-icons-for-twitter-bootstrap-easily

3. I have not yet understood how to make the active link show up on top of the menu bar, but decided to work around the problem since I will have to create individual sites for all the different languages.

3. 我还不明白如何使活动链接显示在菜单栏的顶部,但决定解决这个问题,因为我必须为所有不同的语言创建单独的站点。

回答by Joe Conlin

You should know that the community is all about helping each other out but you will not find anyone to do the work for you. If you are looking for that, try Elance. Otherwise, search Google and make an attempt at it and post some code. From there you will find that you will get to a solution much more quickly.

你应该知道社区就是互相帮助,但你找不到任何人为你做这项工作。如果您正在寻找它,请尝试 Elance。否则,搜索谷歌并尝试它并发布一些代码。从那里你会发现你会更快地找到解决方案。