效果说明:
论坛公告 向上滚动一条 停止 3秒 继续滚下条!再停 !效果好很好!
经测试非官方风格也支持 完整无错版!
技术支持: http://bbs.eno.cc/thread-389-1-1.html
演示:
http://bbs.eno.cc 非官方风格演示
http://www.aodot.net 官方风格演示
适用版本:
DZ 5.0
开发此插件体会:
继本人开发的 D4版本此插件得到了不少朋友的支持!
https://discuz.dismall.com/viewthread.php?tid=301123
从DZ 版本升级后本人没时间开发此插件!而此插件开发也很简单!可没人做!
有很多朋友来消息询问我D5版本的怎么还不出来
故本人在此通宵开发此插件!
需要修改部分:
include/common.js
index.php
templates/default/discuz.htm
开始操作:
打开include/common.js
在最后插入:- var marqueeInterval=new Array();
- var marqueeId=0;
- var marqueeDelay=3000;
- var marqueeHeight=15;
- function initMarquee() {
- var str=marqueeContent[0];
- document.write('<div id=marqueeBox style="overflow:hidden;height:'+marqueeHeight+'px" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay)"><div>'+str+'</div></div>');
- marqueeId++;
- marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay);
- }
- function startMarquee() {
- var str=marqueeContent[marqueeId];
- marqueeId++;
- if(marqueeId>=marqueeContent.length) marqueeId=0;
- if(document.getElementById('marqueeBox').childNodes.length==1) {
- var nextLine=document.createElement('DIV');
- nextLine.innerHTML=str;
- document.getElementById('marqueeBox').appendChild(nextLine);
- } else {
- document.getElementById('marqueeBox').childNodes[0].innerHTML=str;
- document.getElementById('marqueeBox').appendChild(document.getElementById('marqueeBox').childNodes[0]);
- document.getElementById('marqueeBox').scrollTop=0;
- }
- clearInterval(marqueeInterval[1]);
- marqueeInterval[1]=setInterval("scrollMarquee()",20);
- }
- function scrollMarquee() {
- document.getElementById('marqueeBox').scrollTop++;
- if(document.getElementById('marqueeBox').scrollTop%marqueeHeight==(marqueeHeight-1)){
- clearInterval(marqueeInterval[1]);
- }
- }
复制代码 打开 templates/default/discuz.htm
搜索- <!--{if !empty($announcements)}-->
复制代码 将- <div id="announcement" style="clear: both; width: {TABLEWIDTH}">$announcements</div>
- <script type="text/javascript">announcement();</script>
复制代码 替换为- <div id="announcement" style="clear: both; width: {TABLEWIDTH}"><script language="javascript">
- var marqueeContent=new Array();
- $announcements
- initMarquee();
- </script></div>
复制代码 打开index.php
将:- if(empty($gid)) {
- $announcements = $space = '';
- if($_DCACHE['announcements']) {
- foreach($_DCACHE['announcements'] as $announcement) {
- if(empty($announcement['redirect'])) {
- $announcements .= $space.'<a href="announcement.php?id='.$announcement['id'].'#'.$announcement['id'].'"><span class="bold">'.$announcement['subject'].'</span> '.
- '('.gmdate($dateformat, $announcement['starttime'] + $timeoffset * 3600).')</a>';
- } else {
- $announcements .= $space.'<a href="'.$announcement['message'].'" target="_blank"><span class="bold">'.$announcement['subject'].'</span> '.
- '('.gmdate($dateformat, $announcement['starttime'] + $timeoffset * 3600).')</a>';
- }
- $space = ' ';
- }
- }
复制代码 替换为- if(empty($gid)) {
- $announcements = $space = '';
- $announcementn = 0;
- if($_DCACHE['announcements']) {
- foreach($_DCACHE['announcements'] as $announcement) {
- if(empty($announcement['redirect'])) {
- $announcements .= 'marqueeContent['.$announcementn.']=\'<a href="announcement.php?id='.$announcement['id'].'#'.$announcement['id'].'"><span class="bold">'.$announcement['subject'].'</span>('.gmdate($dateformat, $announcement['starttime'] + $timeoffset * 3600).')</a>\';';
- } else {
- $announcements .= 'marqueeContent['.$announcementn.']=\'<a href="'.$announcement['message'].'" target="_blank"><span class="bold">'.$announcement['subject'].'</span>('.gmdate($dateformat, $announcement['starttime'] + $timeoffset * 3600).')</a>\';';
- }
- $announcementn++;
- }
- }
复制代码 |