Jquery implementation of random colorful tag tag random color and size effect
- 2020-03-30 02:30:06
- OfStack
Jquery random colorful tag tag random color and size effect
Js code:
HTML code:
Effect display:
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201403/201403271125462.gif? 2014227112557 ">
Js code:
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var tags_a = $("#tags a");
tags_a.each(function(){
var x = 9;
var y = 0;
var rand = parseInt(Math.random() * (x - y + 1) + y);
$(this).addClass("tags"+rand);
});
})
</script>
HTML code:
<html>
<head>
<style>
body,a{ font-size:13px;}
a{ color:#333333; text-decoration:none;}
.taglist{ width:250px;overflow:hidden;border:#dddddd solid 1px;}
.taglist .tit{ width:100%; height:24px; line-height:24px; background-color:#565662;}
.taglist .tit a{ padding-left:8px; color:#ffffff;}
#tags a{height:26px; line-height:26px;padding-right:6px;}
#tags .tags0{}
#tags .tags1{color:#C00; font-size:24px;}
#tags .tags2{color:#030; font-size:16px;}
#tags .tags3{color:#00F;}
#tags .tags4{ font-size:16px;}
#tags .tags5{color:#C00; font-size:20px;}
#tags .tags6{color:#F06 font-size:20px;}
#tags .tags7{color:#030; font-weight:bold; font-size:18px;}
#tags .tags8{color:#F06; font-weight:bold;}
#tags .tags9{color:#C00; font-weight:bold;font-size:16px;}
#tags a:hover{ color:#F00; text-decoration:underline;}
.w95{ width:95%; margin:0 auto; padding-top:6px; padding-bottom:6px;}
.taglist .w95{}
</style>
</head>
<body>
<div class="taglist">
<div class="tit"><a href="#">TAG The label </a></div>
<div class="w95" id="tags">
<a href='http://www.51xuediannao.com/js/nav/'> Navigation menu </a>
<a href='http://www.51xuediannao.com/js/slide/'> Focus slide </a>
<a href='http://www.51xuediannao.com/js/gg/'> AD code </a>
<a href='http://www.51xuediannao.com/js/texiao/'> Web page special effects </a>
<a href='http://www.51xuediannao.com/js/'>jquery The special effects </a>
<a href='http://www.51xuediannao.com/js/gundong/'> Rolling code </a>
<a href="http://www.51xuediannao.com/tags.php?/%E6%9F%A5%E7%9C%8B%E6%BA%90%E7%A0%81/"> View the source code </a>
<a href="http://www.51xuediannao.com/tags.php?/IE7%E5%8F%98%E6%85%A2/">IE7 slow </a>
<a href="http://www.51xuediannao.com/tags.php?/ET2.0%E9%87%87%E9%9B%86/">ET2.0 collect </a>
<a href="http://www.51xuediannao.com/tags.php?/CSS/">CSS</a>
<a href="http://www.51xuediannao.com/tags.php?/moss2007/">moss2007</a>
<a href="http://www.51xuediannao.com/tags.php?/MOSS%E6%AF%8D%E7%89%88%E9%A1%B5/">MOSS Master page </a>
<a href="http://www.51xuediannao.com/tags.php?/JS%2BCSS%E5%B9%BB%E7%81%AF%E7%89%87/">JS+CSS slide </a>
<a href="http://www.51xuediannao.com/tags.php?/%E7%BD%91%E9%A1%B5%E6%BA%90%E7%A0%81/"> Web site source code </a>
<a href="http://www.51xuediannao.com/tags.php?/%E7%BD%91%E9%A1%B5%E9%85%8D%E8%89%B2/"> Page color </a>
<a href="http://www.51xuediannao.com/tags.php?/301%E9%87%8D%E5%AE%9A%E5%90%91/">301 redirect </a>
<a href="http://www.51xuediannao.com/tags.php?/JS%2BCSS%E5%88%97%E8%A1%A8/">JS+CSS The list of </a>
<a href="http://www.51xuediannao.com/tags.php?/%E9%9A%8F%E6%9C%BA%E6%95%B0/"> The random number </a>
<a href="http://www.51xuediannao.com/tags.php?/%E4%B8%8B%E6%8B%89%E8%8F%9C%E5%8D%95/"> The drop-down menu </a>
</div>
</div>
</body>
</html>
Effect display:
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201403/201403271125462.gif? 2014227112557 ">