第一步
module找到你的侧边栏标签 修改侧边栏标签如下

<?php
//3D标签云
function widget_tag($title){
global $CACHE;
$tag_cache = $CACHE->readCache('tags');?>
<div class="side">
<h3><i class="fa fa-tags mar-r-4"></i><?php echo $title;?></h3>
<div id="tag_cloud_widget">
<div class="tagcloud">
<script type="text/javascript" src="<?php%20echo%20TEMPLATE_URL;%20?>js/3dtag.js"></script>
<?php foreach($tag_cache as $value): ?>
<a href="<?php%20echo%20Url::tag($value['tagurl']);%20?>" title="<?php echo $value['usenum']; ?> 篇文章"><?php echo $value['tagname']; ?></a>
<?php endforeach; ?>
<div class="clear"></div></div></div></div>
<?php }?>

第二步

你的公用模板css放如下css

/*3D标签云*/
#tag_cloud_widget{position:relative;width:240px;height:240px;margin:10px auto 10px}
#tag_cloud_widget a{position:absolute;color:#fff;text-align:center;text-overflow:ellipsis;white-space:nowrap;top:0;left:0;padding:3px 5px;border:0}
#tag_cloud_widget a:hover{background:#d02f53;display:block}
#tag_cloud_widget a:nth-child(n){background:#666;border-radius:3px;display:inline-block;line-height:18px;margin:0 10px 15px 0}
#tag_cloud_widget a:nth-child(2n){background:#d1a601}
#tag_cloud_widget a:nth-child(3n){background:#286c4a}
#tag_cloud_widget a:nth-child(5n){background:#518ab2}
#tag_cloud_widget a:nth-child(4n){background:#c91d13}

第三步

保存下面js为3dtag.js 放到你的模板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('tag_cloud_widget');
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 = '#fff';
this.style.background = '#0099ff';
this.style.padding = '5px 5px';
this.style.filter = "alpha(opacity=100)";
this.style.opacity = 1
}

演示:

Emlog非插件实现3D标签云

Last modification:March 3rd, 2020 at 08:33 am
如果觉得我的文章对你有用,请随意赞赏