褪色颜色回答技巧
Fade color answer trick
例如,当我从答案中复制链接并访问它时,会出现一个漂亮的颜色块来突出显示答案,然后逐渐消失。这是如何做到的呢?
它查看哈希值,选择答案,然后显示背景颜色。要么使用jQuery UI,要么添加Colors插件,以便能够动画颜色。
这就是代码的样子…
var hash = window.location.hash;
if (hash) {
var answer = $('#answer-' + hash.substr(1)),
originalBackgroundColor = answer.css('backgroundColor');
// This class changes the background colur.
// Best to keep style stuff in the CSS layer.
answer
.addClass('linked')
.animate({
backgroundColor: originalBackgroundColor
}, 1000);
// You may optionally remove the added class
// in the callback of the above animation.
}
相关文章:
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 高亮显示时编辑文本大小和颜色
- 用与线条相同的颜色填充多折线图上的点
- 更改使用Chart.js创建的图表中的轴线颜色
- 如何使用jquery更改html中的背景颜色
- 动态更改高图中的系列颜色
- jsf中两个字符串的颜色代码差异
- 我们如何使用css或JavaScript在i/j上更改句点(点)的颜色
- d3.hexbin插件-动态定义颜色域以适应数据
- 关于动作脚本颜色褪色的想法/帮助
- 文本颜色,随时间褪色效果
- 背景颜色不褪色
- 旋转木马的背景颜色褪色
- Javascript背景颜色闪烁与褪色
- 颜色检查后的褪色颜色输入
- 褪色颜色回答技巧
- 如何使用画布制作颜色褪色
- 我如何逐渐放大,而改变鼠标悬停的颜色和逐渐缩小和褪色的颜色上的鼠标房子
- 随着时间的推移,颜色会随着动态形状而褪色
- 褪色的 RGBA 颜色变化