html中的唯美標籤.js(花裏胡哨的)

效果圖

這裏會自己滾動,你也可以在div中添加你需要的a標籤
在這裏插入圖片描述

html在線運行傳送門

wmbq.html源碼

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="https://cdn.bootcss.com/jquery/3.1.0/jquery.min.js"></script>
		<script src="wmbq.js" type="text/javascript" charset="utf-8"></script>
		<style>
			#wmbq{position:relative;height:190px;margin:10px auto 10px;}
			#wmbq a{position:absolute;color:#FFFFFF;text-decoration: none;text-align:center;text-overflow:ellipsis;white-space:nowrap;top:0;left:0;padding:3px 5px;border:0;transition:none;}
			#wmbq a:hover{background: none; display:block;}
			#wmbq a:nth-child(n){display:inline-block;line-height:18px;text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff, 0 0 5px red, 0 0 5px red, 0 0 5px red, 0 0 5px red, 0 0 5px red;}
			#wmbq a:nth-child(2n){text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #FF1177, 0 0 5px #FF1177, 0 0 5px #FF1177, 0 0 5px #FF1177, 0 0 5px #FF1177;}
			#wmbq a:nth-child(3n){text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #228DFF, 0 0 5px #228DFF, 0 0 5px #228DFF, 0 0 5px #228DFF, 0 0 5px #228DFF;}
			#wmbq a:nth-child(4n){text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #000000, 0 0 5px #000000, 0 0 5px #000000, 0 0 5px #000000, 0 0 5px #000000;}
			#wmbq a:nth-child(5n){text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #00ffdc, 0 0 5px #00ffdc, 0 0 5px #00ffdc, 0 0 5px #00ffdc, 0 0 5px #00ffdc;}
			#wmbq a:nth-child(6n){text-shadow: 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #fff, 0 0 5px #ff00de, 0 0 5px #ff00de, 0 0 5px #ff00de, 0 0 5px #ff00de, 0 0 5px #ff00de;}
		</style>
	</head>
	<body>
		<div id="wmbq">
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595" title="·♪關於博客 - 個人資料 - 博客中心♪ ♩ ♫ ">我的博客</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/category_10088814.html" title="·♪項目經驗(後端)♪ ♩ ♫ ">後端編寫</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/category_10088816.html" title="·♪前端編寫(推薦)♪ ♩ ♫ ">前端編寫</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/category_10088807.html" title="·♪工具經驗(雜)♪ ♩ ♫ ">工具經驗</a>
            
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/article/details/106721033" title="·♪html怎樣固定頁面的高(固定容器高度 溢出隱藏)♪ ♩ ♫ ">頁面高度固定</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/article/details/106615199" title="·♪Java爬蟲項目(四 可視化)♪ ♩ ♫··· ">數據庫可視化</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/article/details/106436568" title="·♪jquery實現表頭固定表格自滾動♪ ♩ ♫ ">表格數據自滾動</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/article/details/104947857" title="·♪java超簡單的環境變量 配置+詳解♪ ♩ ♫ ">環境變量配置</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/article/details/106555648" title="·♪html背景渲染原理(body透明漸變)♪ ♩ ♫ ">背景渲染原理</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/article/details/103562081" title="·♪git教程(從安裝到提交文件)♪ ♩ ♫ ">GitLab倉</a>
            <a target="_blank" href="https://blog.csdn.net/weixin_43701595/article/details/103630365" title="·♪javaweb+mysql登錄註冊實現♪ ♩ ♫ ">登錄註冊實現</a>
            
            <a href="JavaScript:" title="·♪Java前端基礎♪ ♩ ♫ ">Html5+Css3+JavaScript+Jquery</a>
            <a href="JavaScript:" title="·♪Java前端進階♪ ♩ ♫ ">bootstrap4+Echarts+WebMagic</a>
            <a href="JavaScript:" title="·♪JavaWeb開發基礎♪ ♩ ♫ ">Java EE(Spring MVC+Spring+MyBatis+Redis)</a>
            <a href="JavaScript:" title="·♪JavaWeb後端進階♪ ♩ ♫ ">SpringBoot</a>
            <a href="JavaScript:" title="·♪系統+雲平臺發佈♪ ♩ ♫ ">Windows7/10+Linux+雲平臺發佈</a>
            <a href="JavaScript:" title="·♪數據庫♪ ♩ ♫ ">MySQL+MongoDB</a>
            <a href="JavaScript:" title="·♪工具♪ ♩ ♫ ">office辦公軟件+Eclipse+idea+IDE+Vs Code</a>
          </div>
		
		
	</body>
</html>

wmbq.js源碼

var radius = 100;

var d = 200;

var dtr = Math.PI / 180;

var mcList = [];

var lasta = 1;

var lastb = 1;

var distr = true;

var tspeed = 11;

var size = 200;

var mouseX = 0;

var mouseY = 10;

var howElliptical = 1;

var aA = null;

var oDiv = null;

window.onload=function ()

{

	var i=0;

	var oTag=null;

	oDiv=document.getElementById('wmbq');

	aA=oDiv.getElementsByTagName('a');

	for(i=0;i<aA.length;i++)

	{

		oTag={};		

		aA[i].onmouseover = (function (obj) {

                return function () {

                    obj.on = true;

                    this.style.zIndex = 9999;

                    this.style.color = '#00000';

                    //this.style.background = '#0099ff';

                    this.style.padding = '5px 5px';

                    this.style.filter = "alpha(opacity=100)";

                    this.style.opacity = 1;

                }

            })(oTag)

            aA[i].onmouseout = (function (obj) {

                return function () {

                    obj.on = false;

                    this.style.zIndex = obj.zIndex;

                    this.style.color = '#00000';

                    //this.style.background = '#30899B';

                    this.style.padding = '5px';

                    this.style.filter = "alpha(opacity=" + 100 * obj.alpha + ")";

                    this.style.opacity = obj.alpha;

                    this.style.zIndex = obj.zIndex;

                }

            })(oTag)

            oTag.offsetWidth = aA[i].offsetWidth;

            oTag.offsetHeight = aA[i].offsetHeight;

            mcList.push(oTag);

	}

	sineCosine( 0,0,0 );

	positionAll();

	(function () {

            update();

            setTimeout(arguments.callee, 40);

        })();

};

function update()

{

	var a, b, c = 0;

        a = (Math.min(Math.max(-mouseY, -size), size) / radius) * tspeed;

        b = (-Math.min(Math.max(-mouseX, -size), size) / radius) * tspeed;

        lasta = a;

        lastb = b;

        if (Math.abs(a) <= 0.01 && Math.abs(b) <= 0.01) {

            return;

        }

        sineCosine(a, b, c);

        for (var i = 0; i < mcList.length; i++) {

            if (mcList[i].on) {

                continue;

            }

            var rx1 = mcList[i].cx;

            var ry1 = mcList[i].cy * ca + mcList[i].cz * (-sa);

            var rz1 = mcList[i].cy * sa + mcList[i].cz * ca;



            var rx2 = rx1 * cb + rz1 * sb;

            var ry2 = ry1;

            var rz2 = rx1 * (-sb) + rz1 * cb;



            var rx3 = rx2 * cc + ry2 * (-sc);

            var ry3 = rx2 * sc + ry2 * cc;

            var rz3 = rz2;



            mcList[i].cx = rx3;

            mcList[i].cy = ry3;

            mcList[i].cz = rz3;



            per = d / (d + rz3);



            mcList[i].x = (howElliptical * rx3 * per) - (howElliptical * 2);

            mcList[i].y = ry3 * per;

            mcList[i].scale = per;

            var alpha = per;

            alpha = (alpha - 0.6) * (10 / 6);

            mcList[i].alpha = alpha * alpha * alpha - 0.2;

            mcList[i].zIndex = Math.ceil(100 - Math.floor(mcList[i].cz));

        }

        doPosition();

}

function depthSort()

{

	var i=0;

	var aTmp=[];

	for(i=0;i<aA.length;i++)

	{

		aTmp.push(aA[i]);

	}

	aTmp.sort

	(

		function (vItem1, vItem2)

		{

			if(vItem1.cz>vItem2.cz)

			{

				return -1;

			}

			else if(vItem1.cz<vItem2.cz)

			{

				return 1;

			}

			else

			{

				return 0;

			}

		}

	);

	for(i=0;i<aTmp.length;i++)

	{

		aTmp[i].style.zIndex=i;

	}

}

function positionAll()

{

	var phi = 0;

    var theta = 0;

    var max = mcList.length;

    for (var i = 0; i < max; i++) {

        if (distr) {

            phi = Math.acos(-1 + (2 * (i + 1) - 1) / max);

            theta = Math.sqrt(max * Math.PI) * phi;

        } else {

            phi = Math.random() * (Math.PI);

            theta = Math.random() * (2 * Math.PI);

        }

        //座標變換

        mcList[i].cx = radius * Math.cos(theta) * Math.sin(phi);

        mcList[i].cy = radius * Math.sin(theta) * Math.sin(phi);

        mcList[i].cz = radius * Math.cos(phi);



        aA[i].style.left = mcList[i].cx + oDiv.offsetWidth / 2 - mcList[i].offsetWidth / 2 + 'px';

        aA[i].style.top = mcList[i].cy + oDiv.offsetHeight / 2 - mcList[i].offsetHeight / 2 + 'px';

    }

}

function doPosition()

{

	var l = oDiv.offsetWidth / 2;

        var t = oDiv.offsetHeight / 2;

        for (var i = 0; i < mcList.length; i++) {

            if (mcList[i].on) {

                continue;

            }

            var aAs = aA[i].style;

            if (mcList[i].alpha > 0.1) {

                if (aAs.display != '')

                    aAs.display = '';

            } else {

                if (aAs.display != 'none')

                    aAs.display = 'none';

                continue;

            }

            aAs.left = mcList[i].cx + l - mcList[i].offsetWidth / 2 + 'px';

            aAs.top = mcList[i].cy + t - mcList[i].offsetHeight / 2 + 'px';

            //aAs.fontSize=Math.ceil(12*mcList[i].scale/2)+8+'px';

            //aAs.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+100*mcList[i].alpha+")";

            aAs.filter = "alpha(opacity=" + 100 * mcList[i].alpha + ")";

            aAs.zIndex = mcList[i].zIndex;

            aAs.opacity = mcList[i].alpha;

        }

}

function sineCosine( a, b, c)

{

	sa = Math.sin(a * dtr);

    ca = Math.cos(a * dtr);

    sb = Math.sin(b * dtr);

    cb = Math.cos(b * dtr);

	sc = Math.sin(c * dtr);

	cc = Math.cos(c * dtr);

}

我們可以將它添加到自己的網站中,例如

在這裏插入圖片描述在這裏插入圖片描述

我已經更改了我之前的個人簡歷博文,這裏是傳送門

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章