首页文章漂浮公告图片

有没有能在首页显示出一个漂浮图片的扩展,能编辑图片大小和链接。图片最好能够全屏自动浮动,就是飘到边缘自动弹回来的效果
谢谢诸位
已邀请:

刘备曹操 - 古今多少事,都付谈笑中

赞同来自:

Joomla 扩展中目前还没有这样的 —— 大概国外开发人员觉得这种飞来飞去的广告有点“闹”吧。
如果你能找到相关的 JS 代码,也可以用“自定义 HTML”模块来实现。

刘备曹操 - 古今多少事,都付谈笑中

赞同来自:

白哥,我找到了这种代码a href="/" mce_href="../" target="_blank"/a

刘备曹操 - 古今多少事,都付谈笑中

赞同来自:

你找到这个代码明显不能用于 Joomla 网站,而且,当你插入代码时,似乎被你的 TinyMCE 编辑器“编辑”了一下,所以代码里出现了很多 mce 标记。
建议将系统默认编辑器改为“无”,然后再去模块中插入代码。
继续寻找其它漂浮广告代码吧。找到了就一个一个测试,直到成功为止。

妥协 - 不会轻易妥协的人不愿意将就的人任性自由的人总是活得比较累

赞同来自:

谢谢白哥,那能给一个js例子吗,可以直接复制上去就用的,我好参考一下

追梦人 - 梦想每个人都有,但不是每个人都有勇气去坚信,我有

赞同来自:

在网上搜到一段代码,似乎可以实现漂浮,你试试看:
var Rimifon = {
"Ads" : new Object,
"NewFloatAd" : function(imgUrl, strLink)
{
var ad = document.createElement("a"&#41
ad.DirV = true;
ad.DirH = true;
ad.AutoMove = true;
ad.Image = new Image;
ad.Seed = Math.random(&#41
ad.Timer = setInterval("Rimifon.Float(" + ad.Seed + ")", 50&#41
this.Ads[ad.Seed] = ad;
ad.Image.Parent = ad;
ad.style.position = "absolute";
ad.style.left = 0;
ad.style.top = 0;
ad.Image.src = imgUrl;
ad.Image.onmouseover = function(){this.Parent.AutoMove = false;}
ad.Image.onmouseout = function(){this.Parent.AutoMove = true;}
if(strLink)
{
ad.href = strLink;
ad.Image.border = 0;
ad.target = "_blank";
}
ad.appendChild(ad.Image&#41
document.body.appendChild(ad&#41
return ad;
},
"Float" : function(floatId)
{
var ad = this.Ads[floatId&#93
if(ad.AutoMove)
{
var curLeft = parseInt(ad.style.left&#41
var curTop = parseInt(ad.style.top&#41
if(ad.offsetWidth + curLeft document.body.clientWidth + document.body.scrollLeft - 1)
{
curLeft = document.body.scrollLeft + document.body.clientWidth - ad.offsetWidth;
ad.DirH = false;
}
if(ad.offsetHeight + curTop document.body.clientHeight + document.body.scrollTop - 1)
{
curTop = document.body.scrollTop + document.body.clientHeight - ad.offsetHeight;
ad.DirV = false;
}
if(curLeft document.body.scrollLeft)
{
curLeft = document.body.scrollLeft;
ad.DirH = true;
}
if(curTop document.body.scrollTop)
{
curTop = document.body.scrollTop;
ad.DirV = true;
}
ad.style.left = curLeft + (ad.DirH ? 1 : -1) + "px";
ad.style.top = curTop + (ad.DirV ? 1 : -1) + "px";
}
}
}



Rimifon.NewFloatAd("http://www.jb51.net/images/logo.gif", "http://www.baidu.com"&#41
var ad = Rimifon.NewFloatAd("http://www.jb51.net/images/logo.gif"&#41
ad.style.left = 500;
ad.style.top = 456;
ad.Image.width = 88;
ad.Image.height = 31;

刘备曹操 - 古今多少事,都付谈笑中

赞同来自:

非常感谢白哥的耐心解答,问题解决
再次感谢

~~~~~~~~~ - 上帝给我的使命,就是证明你们都不是最糟糕的

赞同来自:

白建鹏 写道: 在网上搜到一段代码,似乎可以实现漂浮,你试试看:
var Rimifon = {
"Ads" : new Object,
"NewFloatAd" : function(imgUrl, strLink)
{
var ad = document.createElement("a"&#41
ad.DirV = true;
ad.DirH = true;
ad.AutoMove = true;
ad.Image = new Image;
ad.Seed = Math.random(&#41
ad.Timer = setInterval("Rimifon.Float(" + ad.Seed + ")", 50&#41
this.Ads[ad.Seed] = ad;
ad.Image.Parent = ad;
ad.style.position = "absolute";
ad.style.left = 0;
ad.style.top = 0;
ad.Image.src = imgUrl;
ad.Image.onmouseover = function(){this.Parent.AutoMove = false;}
ad.Image.onmouseout = function(){this.Parent.AutoMove = true;}
if(strLink)
{
ad.href = strLink;
ad.Image.border = 0;
ad.target = "_blank";
}
ad.appendChild(ad.Image&#41
document.body.appendChild(ad&#41
return ad;
},
"Float" : function(floatId)
{
var ad = this.Ads[floatId&#93
if(ad.AutoMove)
{
var curLeft = parseInt(ad.style.left&#41
var curTop = parseInt(ad.style.top&#41
if(ad.offsetWidth + curLeft document.body.clientWidth + document.body.scrollLeft - 1)
{
curLeft = document.body.scrollLeft + document.body.clientWidth - ad.offsetWidth;
ad.DirH = false;
}
if(ad.offsetHeight + curTop document.body.clientHeight + document.body.scrollTop - 1)
{
curTop = document.body.scrollTop + document.body.clientHeight - ad.offsetHeight;
ad.DirV = false;
}
if(curLeft document.body.scrollLeft)
{
curLeft = document.body.scrollLeft;
ad.DirH = true;
}
if(curTop document.body.scrollTop)
{
curTop = document.body.scrollTop;
ad.DirV = true;
}
ad.style.left = curLeft + (ad.DirH ? 1 : -1) + "px";
ad.style.top = curTop + (ad.DirV ? 1 : -1) + "px";
}
}
}



Rimifon.NewFloatAd("http://www.jb51.net/images/logo.gif", "http://www.baidu.com"&#41
var ad = Rimifon.NewFloatAd("http://www.jb51.net/images/logo.gif"&#41
ad.style.left = 500;
ad.style.top = 456;
ad.Image.width = 88;
ad.Image.height = 31;

要回复问题请先登录注册