动网半透明下拉菜单~显示论坛内容~
转自雅趴[url=http://www.yapayapa.com/viewthread.php?tid=2390&fpage=1###]http://www.yapayapa.com/viewthread.php?tid=2390&fpage=1###[/url]实际上2.0也出过这个东西,就是在2.5菜单样势改变了而已~1.
include/forum.php
在最后?>前加上
//论坛导航菜单开始
[code]function popforumlist($fid=0) {
global $db, $groupid, $allowview;
$forumlist = '';
$forums = $GLOBALS['_DCACHE']['forums'];
if(!is_array($forums)) {
$query = $db->query("SELECT fid, type, name, fup, viewperm FROM $GLOBALS[table_forums] WHERE status='1' ORDER BY displayorder");
while($forum = $db->fetch_array($query)) {
$forum['name'] = strip_tags($forum['name']);
$forums[$forum['fid']] = $forum;
}
}
foreach($forums as $fid1 => $forum1) {
if($forum1['type'] == 'group') {
$forumlistarea = '';
foreach($forums as $fid2 => $forum2) {
if($forum2['fup'] == $fid1 && $forum2['type'] == 'forum' && ((!$forum2['viewperm'] && $allowview) || ($forum2['viewperm'] && strstr($forum2['viewperm'], "\t$groupid\t")))) {
if(!$fid || ($fid == $fid1) || ($fid == $fid2)) {
if(!$fid || ($fid != $fid2)) {
$forumlistarea .= ' <img src=images/ppp.gif> <a href=forumdisplay.php?fid='.$fid2.' >'.$forum2['name'].'</a> <br>';
}
foreach($forums as $fid3 => $forum3) {
if($forum3['fup'] == $fid2 && $forum3['type'] == 'sub' && ((!$forum3['viewperm'] && $allowview) || ($forum3['viewperm'] && strstr($forum3['viewperm'], "\t$groupid\t")))) {
$forumlistarea .= ' <img src=images/ppp.gif> <a href=forumdisplay.php?fid='.$fid3.' >'.$forum3['name'].'</a> <br>';
}
}
}
}
}
if($forumlistarea != "") {
if(!$fid) {
$forumlist .= ' <img src=images/ppp1.gif> <a href=index.php?gid='.$fid1.' style=font-weight=bolder >'.$forum1['name'].'</a> <br>';
}
$forumlist .= $forumlistarea;
}
} elseif(!$forum1['fup'] && $forum1['type'] == 'forum' && ((!$forum1['viewperm'] && $allowview) || ($forum1['viewperm'] && strstr($forum1['viewperm'], "\t$groupid\t")))) {
if(!$fid || ($fid==$fid1)) {
if(!$fid || ($fid!=$fid1)) {
$forumlist .= ' <img src=images/ppp.gif> <a href=forumdisplay.php?fid='.$fid1.' >'.$forum1['name'].'</a> <br>';
}
foreach($forums as $fid2 => $forum2) {
if($forum2['fup'] == $fid1 && $forum2['type'] == 'sub' && ((!$forum2['viewperm'] && $allowview) || ($forum2['viewperm'] && strstr($forum2['viewperm'], "\t$groupid\t")))) {
$forumlist .= ' <img src=images/ppp.gif> <a href=forumdisplay.php?fid='.$fid2.' >'.$forum2['name'].'</a> <br>';
}
}
}
}
}
return $forumlist;
}
//论坛导航菜单结束
[/code]
如果不想要那个图片可以删除<img src=images/ppp1.gif>和
<img src=images/ppp.gif>
2.应用于浏览主题列表时
forumdisplay.php
找
[code]$popboardlist = popforumlist();
if($forum['type'] == 'forum') {
$navigation = "» $forum[name]";
$navtitle = ' - '.strip_tags($forum['name']);
} else {
$forumup = $_DCACHE['forums'][$forum['fup']]['name'];
$navigation = "» <a href=\"forumdisplay.php?fid=$forum[fup]\">$forumup</a> » $forum[name]";
$navtitle = ' - '.strip_tags($forumup).' - '.strip_tags($forum['name']);
}
[/code]
替换成
[code]if($forum['type'] == 'forum') {
$groupname = $_DCACHE['forums'][$forum['fup']]['name'];
$popgrouplist = popforumlist($forum[fup]);
$navigation .= "<font color=darkgray>» <a href=\"index.php?gid=$forum[fup]\" onmouseover=\"showmenu(event,'$popgrouplist')\" style=\"CURSOR:hand\">$groupname</a> » <a href=\"forumdisplay.php?fid=$fid\">$forum[name]</a></font>";
$navtitle = " - $groupname - $forum[name]";
} else {
$forumup = $_DCACHE['forums'][$forum['fup']]['name'];
$popforumlist = popforumlist($forum[fup]);
$groupgid = $_DCACHE['forums'][$forum['fup']]['fup'];
$popgrouplist = popforumlist($groupgid);
$groupname = $_DCACHE['forums'][$groupgid]['name'];
$navigation .= "<font color=darkgray>» <a href=\"index.php?gid=$groupgid\" onmouseover=\"showmenu(event,'$popgrouplist')\" style=\"CURSOR:hand\">$groupname</a> » <a href=\"forumdisplay.php?fid=$forum[fup]\" onmouseover=\"showmenu(event,'$popforumlist')\" style=\"CURSOR:hand\">$forumup</a> » <a href=\"forumdisplay.php?fid=$fid\">$forum[name]</a></font>";
$navtitle = " - $groupname - $forumup - $forum[name]";
}
[/code]
templates/default/forumdisplay.htm
查找到
[code]<tr><td class="nav" width="90%" nowrap> <a href="index.php">$bbname</a> $navigation</td>
[/code]
替换为
[code]<tr>
<td class="nav" width="90%" align="left" nowrap> <a href="index.php" onMouseOver="showmenu(event,'<br>$popboardlist<br>')" style="CURSOR:hand">$bbname</a> $navigation
<!--{if $mypost == '1'}-->
» {lang threads_mypost}
<!--{/if}-->
<!--{if $filter == 'digest'}-->
» {lang threads_digest}
<!--{/if}-->
</td>
[/code]
3.应用于浏览帖子内容时
viewthread.php
找
[code]if($forum['type'] == 'forum') {
$navigation .= "» <a href=\"forumdisplay.php?fid=$fid&page=$fpage\"> $forum[name]</a> » $thread[subject]";
$navtitle .= ' - '.strip_tags($forum['name']).' - '.$thread['subject'];
} else {
$query = $db->query("SELECT fid, name, moderator FROM $table_forums WHERE fid='$forum[fup]'");
$fup = $db->fetch_array($query);
$navigation .= "» <a href=\"forumdisplay.php?fid=$fup[fid]\">$fup[name]</a> » <a href=\"forumdisplay.php?fid=$fid&page=$fpage\"> $forum[name]</a> » $thread[subject]";
$navtitle .= ' - '.strip_tags($fup['name']).' - '.strip_tags($forum['name']).' - '.$thread['subject'];
}
[/code]
替换为
[code]$popboardlist = popforumlist();
$curr_page = $fpage ? "@ <a href=\"forumdisplay.php?fid=$fid&page=$fpage\"> Page: $fpage </a>" : "";
if($forum['type'] == 'forum') {
$groupname = $_DCACHE['forums'][$forum['fup']]['name'];
$popgrouplist = popforumlist($forum[fup]);
$navigation .= "<font color=darkgray>» <a href=\"index.php?gid=$forum[fup]\" onmouseover=\"showmenu(event,'$popgrouplist')\" style=\"CURSOR:hand\">$groupname</a> » <a href=\"forumdisplay.php?fid=$fid\">$forum[name]</a> $curr_page»</font> $thread[subject]";
$navtitle .= " - $groupname - $forum[name] - $thread[subject]";
} else {
$forumup = $_DCACHE['forums'][$forum['fup']]['name'];
$popforumlist = popforumlist($forum[fup]);
$groupgid = $_DCACHE['forums'][$forum['fup']]['fup'];
$popgrouplist = popforumlist($groupgid);
$groupname = $_DCACHE['forums'][$groupgid]['name'];
$navigation .= "<font color=darkgray>» <a href=\"index.php?gid=$groupgid\" onmouseover=\"showmenu(event,'$popgrouplist')\" style=\"CURSOR:hand\">$groupname</a> » <a href=\"forumdisplay.php?fid=$forum[fup]\" onmouseover=\"showmenu(event,'$popforumlist')\" style=\"CURSOR:hand\">$forumup</a> » <a href=\"forumdisplay.php?fid=$fid\">$forum[name]</a> $curr_page»</font> $thread[subject]";
$navtitle .= " - $groupname - $forumup - $forum[name] - $thread[subject]";
}
[/code]
templates/default/viewthread.htm
找
[code]<tr><td class="nav" width="90%" nowrap> <a href="index.php">$bbname</a> $navigation</td>
[/code]
替换为
[code]<tr>
<td class="nav" width="90%" align="left" nowrap> <a href="index.php" onMouseOver="showmenu(event,'<br>$popboardlist<br>')" style="CURSOR:hand">$bbname</a> $navigation
</td>
[/code]
4.用于浏览分区列表时
index.php查找到
[code] $navigation = '» '.$cat['name'];
$navtitle = ' - '.strip_tags($cat['name']);
[/code]
替换为
[code]
$popboardlist = popforumlist();
$navigation = '<font color=darkgray>» <a href=index.php?gid='.$gid.'>'.$cat['name'].'</a></font>';
[/code]
templates/default/index.htm
查找到
[code]<tr><td class="nav" width="90%" nowrap> <a href="index.php">$bbname</a> $navigation</td>
[/code]
替换为
[code]<tr><td class="nav" width="90%" nowrap> <a href="index.php" <!--{if $gid}-->onmouseover="ShowMenu('$popboardlist')"<!--{/if}-->>$bbname</a> $navigation</td>
[/code]
效果就像鼠标悬停在本论坛论坛名称上一样~ 完全改了
不行啊 改了!没变化! 在2.5f sp-1版本中. 好像某些字串不一樣!!
當然改了沒效果...= ="
装这个先装这个试试.
http://old.freediscuz.net/old/viewthread.php?tid=31814&fpage=1&highlight=%B6%AF%CD%F8###[color=#ff0000]请先备份相关文件
[/color]修改 include/common.js
于文件尾加入 ( 若之前已安装菜单 , 请将之前菜单的代码删掉 )
[code]<!--
var menuOffX=0 //菜单距连接文字最左端距离
var menuOffY=18 //菜单距连接文字顶端距离
var fo_shadows=new Array()
var linkset=new Array()
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers
function openScript(url, width, height){
var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no' );
}
function showmenu(e,vmenu,mod){
if (!document.all&&!document.getElementById&&!document.layers)
return
which=vmenu
clearhidemenu()
ie_clearshadow()
menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj
if (ie4||ns6)
menuobj.innerHTML=which
else{
menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
menuobj.document.close()
}
menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
eventX=ie4? event.clientX : ns6? e.clientX : e.x
eventY=ie4? event.clientY : ns6? e.clientY : e.y
var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
if (rightedge<menuobj.contentwidth)
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
else
menuobj.thestyle.left=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX
if (bottomedge<menuobj.contentheight&&mod!=0)
menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY
else
menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY
menuobj.thestyle.visibility="visible"
ie_dropshadow(menuobj,"#999999",3)
return false
}
function ie_y(e){
var t=e.offsetTop;
while(e=e.offsetParent){
t+=e.offsetTop;
}
return t;
}
function ie_x(e){
var l=e.offsetLeft;
while(e=e.offsetParent){
l+=e.offsetLeft;
}
return l;
}
function ie_dropshadow(el, color, size)
{
var i;
for (i=size; i>0; i--)
{
var rect = document.createElement('div');
var rs = rect.style
rs.position = 'absolute';
rs.left = (el.style.posLeft + i) + 'px';
rs.top = (el.style.posTop + i) + 'px';
rs.width = el.offsetWidth + 'px';
rs.height = el.offsetHeight + 'px';
rs.zIndex = el.style.zIndex - i;
rs.backgroundColor = color;
var opacity = 1 - i / (i + 1);
rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
//el.insertAdjacentElement('afterEnd', rect);
fo_shadows[fo_shadows.length] = rect;
}
}
function ie_clearshadow()
{
for(var i=0;i<fo_shadows.length;i++)
{
if (fo_shadows[i])
fo_shadows[i].style.display="none"
}
fo_shadows=new Array();
}
function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
function hidemenu(){
if (window.menuobj)
menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
ie_clearshadow()
}
function dynamichide(e){
if (ie4&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}
function delayhidemenu(){
if (ie4||ns6||ns4)
delayhide=setTimeout("hidemenu()",500)
}
function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}
function highlightmenu(e,state){
if (document.all)
source_el=event.srcElement
else if (document.getElementById)
source_el=e.target
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : ""
}
else{
while(source_el.id!="popmenu"){
source_el=document.getElementById? source_el.parentNode : source_el.parentElement
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : ""
}
}
}
}
//-->
[/code]
修改 css.htm
于 </style> 前加入
[code].menuskin {
filter: Alpha(Opacity=80);
BORDER: #666666 1px solid; VISIBILITY: hidden; FONT: 12px Verdana;
POSITION: absolute;
BACKGROUND-COLOR:#FFFFFF;
background-repeat : repeat-y;
}
.menuskin A {
PADDING-RIGHT: 9px; PADDING-LEFT: 7px; COLOR: black; TEXT-DECORATION: none; behavior:url(inc/noline.htc);
}
#mouseoverstyle {
BACKGROUND-COLOR: #F2F5FB; margin:2px; padding:0px; border:#8396C3 1px solid;
}
#mouseoverstyle A {
COLOR: black
}
.menuitems{
margin:2px;padding:1px;word-break:keep-all;
}
[/code]
修改 header.htm
1.把之前菜单代码删掉 , 于body标签后面增加
[code]<div class=menuskin id=popmenu
onmouseover="clearhidemenu();highlightmenu(event,'on')"
onmouseout="highlightmenu(event,'off');dynamichide(event)" style="Z-index:100"></div>
[/code]
2.连接参考如下
这个就不用了..
要是你以前装这个就不用了再装了.
这个下拉菜单是指
☆┈┋ 恋 雾 迷 尘 论 坛 ┋┈☆ ° » ※论坛专区※ » ≮ Discuz!论坛 ≯
点这里的下拉菜单.
我论坛是先照这个,再装一楼的.
应该是不会有什么问题~ 請問修改index.htm檔時.
如果裡面的字串完全不一樣怎麼修改?
例如找尋
[code]<tr><td class="nav" width="90%" nowrap> <a href="index.php">$bbname</a> $navigation</td>[/code]
替換為
[code]<tr><td class="nav" width="90%" nowrap> <a href="index.php" <!--{if $gid}-->onmouseover="ShowMenu('$popboardlist')"<!--{/if}-->>$bbname</a> $navigation</td>[/code]
可是2.5F SP-1版本好像不一樣![11.gif]
原檔:[url=http://mochin.myweb.hinet.net/temp/index.rar]http://mochin.myweb.hinet.net/temp/index.rar[/url] 那你找到这句差不的,这样子就可以了
[code]<a href="index.php" <!--{if $gid}-->onmouseover="ShowMenu('$popboardlist')"<!--{/if}-->>[/code] 谢谢啊,看你这里有这个效果,居然让我找到了修改方法,哈哈 高兴!
页:
[1]