切换两个箭头的颜色
toggle the colors of two arrows
我有看起来像这样的代码,https://jsfiddle.net/mdwxbppd/
<span class="glyphicon glyphicon-triangle-top col-md-12" aria-hidden="true"></span><br />
<span class="col-md-12" style="height: 1px; font-family: 'Passion One', cursive; bottom: 10px; padding-left: 0.01em;">
<h4 id="vote_count_{{ post.slug }}">
{{ post.get_vote_count }}
</h4>
</span><br>
<span class="glyphicon glyphicon-triangle-bottom col-md-12" aria-hidden="true"></span>
我正在尝试实现按钮在单击每个按钮时切换颜色。我试过了,但是每当我刷新页面时,颜色都会恢复到原始颜色,直到我单击其他箭头(因为它们切换)。任何帮助将不胜感激。
这是我尝试过的:
<script>
$(document).ready(function(){
$('.glyphicon').click(function(){
$('.glyphicon').css('color', '#333');
$(this).css('color', '#10fd01');
});
});
</script>
我不确定,这就是你要找的,但如果是,请尝试以下操作:
$(document).ready(function(){
if($.cookie("arrow1")){
//$('#arrow1').toggleClass... or whatever
}
$('span.glyphicon').click(function(e){
$.cookie(e.target.id, true);
//e.target.toggle class, e.target.style.color =... or whatever
});
});
相关文章:
- JQuery合并了keyup和focusout两个函数
- 如何使用 node.js 比较两个 json 数组
- jsf中两个字符串的颜色代码差异
- 在画布上绘制两个不同颜色的形状
- 切换两个箭头的颜色
- 一次改变一个盒子的颜色,而不是两个
- 切换两个箭头的颜色更改
- 如何组合两个单独的Uint8Array的颜色数据(JPEG)和透明度数据(PNG)
- 如何显示两个颜色框(弹出窗口)
- 如何使用两个不同颜色的按钮更改表格单元格(td)的背景颜色
- 颜色框在图像处有两个链接,但在组中显示一次
- 如何将一个元素的背景颜色与两个半透明元素的背景颜色相匹配
- 两个选择的rgb颜色之间的随机颜色(JavaScript)
- 用于检查两个HSL颜色值是否有不良对比度的算法
- 两个径向渐变的颜色,结合时结合
- jqplot:如果我有两个饼图,我能使每个具有相同标签的楔形具有相同的颜色吗?
- 如何使用javascript改变两个元素的颜色
- 在同一页面上弹出两个不同的颜色框,分别设置
- Javascript如何比较两个值,然后更改背景颜色
- 使用javascript在两个背景颜色之间切换一个按钮