将向上或向下箭头添加到切换以显示文本的标题
Add up or down arrows to headers that are toggled to display text
我有一些基于 JQuery 和 Bootstrap 的脚本,允许我通过单击前面的标题来控制文本块显示或不显示。
下面是存储在我的数据库中的标题和文本块的示例:
<h2 id="where" data-toggle="collapse" data-target=".Header2,.Where">Where am I?</h2>
<section class="ConSec Where">
<p>If you’ve ever worked in the Alaskan wilderness or explored Africa, you know how easy it is to get lost. (I’ve been temporarily lost three or four times – in fog, dense forests and in a blizzard on the Arctic Ocean.)</p>
</section>
我的JavaScript技能相当弱,所以我还不明白它是如何工作的。我的页面上有一些类似的功能,由此脚本控制:
<script>
$("#intro").click(function(e) {
e.preventDefault();
$("#intro,.ConSec").toggleClass("texted");
});
</script>
但是,即使我删除了上面的脚本,我也可以打开和关闭文本块,所以也许它是由 CSS 控制的。
我想修改我的代码,以便标题显示向上或向下箭头,类似于维基百科的移动页面;例如 http://en.m.wikipedia.org/wiki/Mammal
如果你向下滚动到一个标题(例如"区分特征"或"分类"(,你就会明白我的意思。
我不确定这些箭头是图像还是某种字体字符。我想知道是否有人可以告诉我如何制作类似的东西。我可能会想出一些使用图像的方法,但它会非常业余。
尝试将以下跨度添加到 h2 中:
<span class="glyphicon glyphicon-chevron-up"></span>
所以它看起来像...
<h2 id="where" data-toggle="collapse" data-target=".Header2,.Where">
<span class="glyphicon glyphicon-chevron-up"></span>
Where am I?
</h2>
您可以在此处找到不同引导程序图标的代码:http://getbootstrap.com/components/
只需将glyphicon-chevron-up
替换为您想要的即可。
相关文章:
- 当我悬停使用php连接到mysql的图像时显示标题
- 如何使用 bootstrap3 和 php 突出显示标题中的活动页面
- chart js:如何显示标题或标签
- 从下拉菜单选项中显示“标题”标签
- 如何在可展开菜单中正确显示标题
- Spotify 应用程序 - 列表不显示播放列表的曲目,只显示标题
- 在 asp.net 中使用 javascript 显示标题属性消息
- 引导灯箱:显示标题属性中的图像说明
- 在浏览器的选项卡中显示标题
- 如何按焦点在 HTML 元素上显示标题
- 加载随机背景音乐并显示标题
- 如何使用ES6 angular 1.3控制器显示标题
- 在图像下方垂直和水平居中显示标题
- 如何使用d3.js在SVG图表上居中显示标题
- 在网页上显示标题或替换文本
- 如何有一个淘汰网格显示标题和基于下拉结果的数据
- 谷歌地图显示标题的信息框
- 仅在切换类时显示标题和段落
- JQuery在图像悬停显示标题标签内容,可能的
- JQuery周日历:在初始加载时只显示标题