Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-22-2009, 05:24 PM
tijmen_4real tijmen_4real is offline
 
Join Date: Oct 2008
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Add floating menu to which page/template?

Hi,

I would like to add a floating menu to my board, instead of the default navbar. So i made a 100x150 Flash menu, and got the code to make it work as a floating menu.

But, to which template can this code be added to work on each page as a menu?
Greetz,

tijmen_4real
Reply With Quote
  #2  
Old 02-24-2009, 04:56 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want to replace the navbar, naturally, you would edit the navbar template.
Reply With Quote
  #3  
Old 02-24-2009, 07:39 AM
tijmen_4real tijmen_4real is offline
 
Join Date: Oct 2008
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So i added this code to the (common) header template:

PHP Code:
<!-- FLOATING MENU -->
<
div id="floatdiv" style="
    position:absolute;
    width:100px;height:150px;"
>
<
script language="javascript">
    if (
AC_FL_RunContent == 0) {
        
alert("Deze pagina vereist AC_RunActiveContent.js.");
    } else {
        
AC_FL_RunContent(
            
'codebase''http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
            
'width''100',
            
'height''150',
            
'src''http://www.deorvanheemskerk.nl/floatingmenu/menu.swf',
            
'quality''high',
            
'pluginspage''http://www.macromedia.com/go/getflashplayer',
            
'align''middle',
            
'play''true',
            
'loop''true',
            
'scale''showall',
            
'wmode''transparent',
            
'devicefont''false',
            
'id''menu',
            
'bgcolor''#ffffff',
            
'name''menu',
            
'menu''false',
            
'allowFullScreen''false',
            
'allowScriptAccess','sameDomain',
            
'movie''menu',
            
'salign'''
            
); //end AC code
    
}
</
script>
<
noscript>
    <
object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100" height="150" id="menu" align="middle">
    <
param name="allowScriptAccess" value="sameDomain" />
    <
param name="allowFullScreen" value="false" />
    <
param name="wmode" value="transparent" />
    <
param name="movie" value="menu.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />    <embed src="http://www.deorvanheemskerk.nl/floatingmenu/menu.swf" quality="high" width="100" height="150" name="menu" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </
object>
</
noscript>
</
div>

<
script type="text/javascript"><!--
/* Script by: www.jtricks.com
 * Version: 20071017
 * Latest version:
 * www.jtricks.com/javascript/navigation/floating.html
 */
var floatingMenuId 'floatdiv';
var 
floatingMenu =
{
    
targetX0,
    
targetY: -450,

    
hasInnertypeof(window.innerWidth) == 'number',
    
hasElementtypeof(document.documentElement) == 'object'
        
&& typeof(document.documentElement.clientWidth) == 'number',

    
menu:
        
document.getElementById
        
document.getElementById(floatingMenuId)
        : 
document.all
          
document.all[floatingMenuId]
          : 
document.layers[floatingMenuId]
};

floatingMenu.move = function ()
{
    
floatingMenu.menu.style.left floatingMenu.nextX 'px';
    
floatingMenu.menu.style.top floatingMenu.nextY 'px';
}

floatingMenu.computeShifts = function ()
{
    var 
de document.documentElement;

    
floatingMenu.shiftX =  
        
floatingMenu.hasInner  
        
pageXOffset  
        
floatingMenu.hasElement  
          
de.scrollLeft  
          
document.body.scrollLeft;  
    if (
floatingMenu.targetX 0)
    {
        
floatingMenu.shiftX +=
            
floatingMenu.hasElement
            
de.clientWidth
            
document.body.clientWidth;
    }

    
floatingMenu.shiftY =
        
floatingMenu.hasInner
        
pageYOffset
        
floatingMenu.hasElement
          
de.scrollTop
          
document.body.scrollTop;
    if (
floatingMenu.targetY 0)
    {
        if (
floatingMenu.hasElement && floatingMenu.hasInner)
        {
            
// Handle Opera 8 problems
            
floatingMenu.shiftY +=
                
de.clientHeight window.innerHeight
                
window.innerHeight
                
de.clientHeight
        
}
        else
        {
            
floatingMenu.shiftY +=
                
floatingMenu.hasElement
                
de.clientHeight
                
document.body.clientHeight;
        }
    }
}

floatingMenu.calculateCornerX = function()
{
    if (
floatingMenu.targetX != 'center')
        return 
floatingMenu.shiftX floatingMenu.targetX;

    var 
width parseInt(floatingMenu.menu.offsetWidth);

    var 
cornerX =
        
floatingMenu.hasElement
        
? (floatingMenu.hasInner
           
pageXOffset
           
document.documentElement.scrollLeft) +
          (
document.documentElement.clientWidth width)/2
        
document.body.scrollLeft +
          (
document.body.clientWidth width)/2;
    return 
cornerX;
};

floatingMenu.calculateCornerY = function()
{
    if (
floatingMenu.targetY != 'center')
        return 
floatingMenu.shiftY floatingMenu.targetY;

    var 
height parseInt(floatingMenu.menu.offsetHeight);

    
// Handle Opera 8 problems
    
var clientHeight =
        
floatingMenu.hasElement && floatingMenu.hasInner
        
&& document.documentElement.clientHeight
            
window.innerHeight
        
window.innerHeight
        
document.documentElement.clientHeight

    
var cornerY =
        
floatingMenu.hasElement
        
? (floatingMenu.hasInner  
           
pageYOffset
           
document.documentElement.scrollTop) +
          (
clientHeight height)/2
        
document.body.scrollTop +
          (
document.body.clientHeight height)/2;
    return 
cornerY;
};

floatingMenu.doFloat = function()
{
    var 
stepXstepY;

    
floatingMenu.computeShifts();

    var 
cornerX floatingMenu.calculateCornerX();

    var 
stepX = (cornerX floatingMenu.nextX) * .07;
    if (
Math.abs(stepX) < .5)
    {
        
stepX cornerX floatingMenu.nextX;
    }

    var 
cornerY floatingMenu.calculateCornerY();

    var 
stepY = (cornerY floatingMenu.nextY) * .07;
    if (
Math.abs(stepY) < .5)
    {
        
stepY cornerY floatingMenu.nextY;
    }

    if (
Math.abs(stepX) > ||
        
Math.abs(stepY) > 0)
    {
        
floatingMenu.nextX += stepX;
        
floatingMenu.nextY += stepY;
        
floatingMenu.move();
    }

    
setTimeout('floatingMenu.doFloat()'20);
};

// addEvent designed by Aaron Moore
floatingMenu.addEvent = function(elementlistenerhandler)
{
    if(
typeof element[listener] != 'function' ||
       
typeof element[listener '_num'] == 'undefined')
    {
        
element[listener '_num'] = 0;
        if (
typeof element[listener] == 'function')
        {
            
element[listener 0] = element[listener];
            
element[listener '_num']++;
        }
        
element[listener] = function(e)
        {
            var 
true;
            
= (e) ? window.event;
            for(var 
element[listener '_num'] -1>= 0i--)
            {
                if(
element[listener i](e) == false)
                    
false;
            }
            return 
r;
        }
    }

    
//if handler is not already stored, assign it
    
for(var 0element[listener '_num']; i++)
        if(
element[listener i] == handler)
            return;
    
element[listener element[listener '_num']] = handler;
    
element[listener '_num']++;
};

floatingMenu.init = function()
{
    
floatingMenu.initSecondary();
    
floatingMenu.doFloat();
};

// Some browsers init scrollbars only after
// full document load.
floatingMenu.initSecondary = function()
{
    
floatingMenu.computeShifts();
    
floatingMenu.nextX floatingMenu.calculateCornerX();
    
floatingMenu.nextY floatingMenu.calculateCornerY();
    
floatingMenu.move();
}

if (
document.layers)
    
floatingMenu.addEvent(window'onload'floatingMenu.init);
else
{
    
floatingMenu.init();
    
floatingMenu.addEvent(window'onload',
        
floatingMenu.initSecondary);
}

//--></script>
<!-- /FLOATING MENU --> 
When i use the code in a single HTML file, with all the files in the same folder, i don't have any problems. But when i add this code to the template, i don't see any menu...

This is how the template looks with the code of the floating menu:

PHP Code:
<!-- logo -->
<
a name="top"></a>
<
table border="0" width="$stylevar[outertablewidth]cellpadding="0" cellspacing="0" align="center">
<
tr>
    <!--<
td align="$stylevar[left]">-->
<
td align="center" style="padding:0;" style="margin:0;><a href="$vboptions[forumhome].php$session[sessionurl_q]"><img style="margin-top:-20px;" src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a></td>
    <!--<td align="
$stylevar[right]" id="header_right_cell">-->
        <if condition="
$ad_location['ad_header_logo']">$ad_location[ad_header_logo]<else />&nbsp;</if>
    </td>
</tr>
</table>
<!-- /logo -->

<!-- FLOATING MENU -->
<div id="
floatdiv" style="
    
position:absolute;
    
width:100px;height:150px;">
<script language="
javascript">
    if (AC_FL_RunContent == 0) {
        alert("
Deze pagina vereist AC_RunActiveContent.js.");
    } else {
        AC_FL_RunContent(
            'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
            'width', '100',
            'height', '150',
            'src', 'http://www.deorvanheemskerk.nl/floatingmenu/menu.swf',
            'quality', 'high',
            'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
            'align', 'middle',
            'play', 'true',
            'loop', 'true',
            'scale', 'showall',
            'wmode', 'transparent',
            'devicefont', 'false',
            'id', 'menu',
            'bgcolor', '#ffffff',
            'name', 'menu',
            'menu', 'false',
            'allowFullScreen', 'false',
            'allowScriptAccess','sameDomain',
            'movie', 'menu',
            'salign', ''
            ); //end AC code
    }
</script>
<noscript>
    <object classid="
clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100" height="150" id="menu" align="middle">
    
<param name="allowScriptAccess" value="sameDomain" />
    <
param name="allowFullScreen" value="false" />
    <
param name="wmode" value="transparent" />
    <
param name="movie" value="menu.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />    <embed src="http://www.deorvanheemskerk.nl/floatingmenu/menu.swf" quality="high" width="100" height="150" name="menu" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </
object>
</
noscript>
</
div>

<
script type="text/javascript"><!--
/* Script by: www.jtricks.com
 * Version: 20071017
 * Latest version:
 * www.jtricks.com/javascript/navigation/floating.html
 */
var floatingMenuId 'floatdiv';
var 
floatingMenu =
{
    
targetX0,
    
targetY: -450,

    
hasInnertypeof(window.innerWidth) == 'number',
    
hasElementtypeof(document.documentElement) == 'object'
        
&& typeof(document.documentElement.clientWidth) == 'number',

    
menu:
        
document.getElementById
        
document.getElementById(floatingMenuId)
        : 
document.all
          
document.all[floatingMenuId]
          : 
document.layers[floatingMenuId]
};

floatingMenu.move = function ()
{
    
floatingMenu.menu.style.left floatingMenu.nextX 'px';
    
floatingMenu.menu.style.top floatingMenu.nextY 'px';
}

floatingMenu.computeShifts = function ()
{
    var 
de document.documentElement;

    
floatingMenu.shiftX 
        
floatingMenu.hasInner 
        
pageXOffset 
        
floatingMenu.hasElement 
          
de.scrollLeft 
          
document.body.scrollLeft
    if (
floatingMenu.targetX 0)
    {
        
floatingMenu.shiftX +=
            
floatingMenu.hasElement
            
de.clientWidth
            
document.body.clientWidth;
    }

    
floatingMenu.shiftY =
        
floatingMenu.hasInner
        
pageYOffset
        
floatingMenu.hasElement
          
de.scrollTop
          
document.body.scrollTop;
    if (
floatingMenu.targetY 0)
    {
        if (
floatingMenu.hasElement && floatingMenu.hasInner)
        {
            
// Handle Opera 8 problems
            
floatingMenu.shiftY +=
                
de.clientHeight window.innerHeight
                
window.innerHeight
                
de.clientHeight
        
}
        else
        {
            
floatingMenu.shiftY +=
                
floatingMenu.hasElement
                
de.clientHeight
                
document.body.clientHeight;
        }
    }
}

floatingMenu.calculateCornerX = function()
{
    if (
floatingMenu.targetX != 'center')
        return 
floatingMenu.shiftX floatingMenu.targetX;

    var 
width parseInt(floatingMenu.menu.offsetWidth);

    var 
cornerX =
        
floatingMenu.hasElement
        
? (floatingMenu.hasInner
           
pageXOffset
           
document.documentElement.scrollLeft) +
          (
document.documentElement.clientWidth width)/2
        
document.body.scrollLeft +
          (
document.body.clientWidth width)/2;
    return 
cornerX;
};

floatingMenu.calculateCornerY = function()
{
    if (
floatingMenu.targetY != 'center')
        return 
floatingMenu.shiftY floatingMenu.targetY;

    var 
height parseInt(floatingMenu.menu.offsetHeight);

    
// Handle Opera 8 problems
    
var clientHeight =
        
floatingMenu.hasElement && floatingMenu.hasInner
        
&& document.documentElement.clientHeight
            
window.innerHeight
        
window.innerHeight
        
document.documentElement.clientHeight

    
var cornerY =
        
floatingMenu.hasElement
        
? (floatingMenu.hasInner 
           
pageYOffset
           
document.documentElement.scrollTop) +
          (
clientHeight height)/2
        
document.body.scrollTop +
          (
document.body.clientHeight height)/2;
    return 
cornerY;
};

floatingMenu.doFloat = function()
{
    var 
stepXstepY;

    
floatingMenu.computeShifts();

    var 
cornerX floatingMenu.calculateCornerX();

    var 
stepX = (cornerX floatingMenu.nextX) * .07;
    if (
Math.abs(stepX) < .5)
    {
        
stepX cornerX floatingMenu.nextX;
    }

    var 
cornerY floatingMenu.calculateCornerY();

    var 
stepY = (cornerY floatingMenu.nextY) * .07;
    if (
Math.abs(stepY) < .5)
    {
        
stepY cornerY floatingMenu.nextY;
    }

    if (
Math.abs(stepX) > ||
        
Math.abs(stepY) > 0)
    {
        
floatingMenu.nextX += stepX;
        
floatingMenu.nextY += stepY;
        
floatingMenu.move();
    }

    
setTimeout('floatingMenu.doFloat()'20);
};

// addEvent designed by Aaron Moore
floatingMenu.addEvent = function(elementlistenerhandler)
{
    if(
typeof element[listener] != 'function' ||
       
typeof element[listener '_num'] == 'undefined')
    {
        
element[listener '_num'] = 0;
        if (
typeof element[listener] == 'function')
        {
            
element[listener 0] = element[listener];
            
element[listener '_num']++;
        }
        
element[listener] = function(e)
        {
            var 
true;
            
= (e) ? window.event;
            for(var 
element[listener '_num'] -1>= 0i--)
            {
                if(
element[listener i](e) == false)
                    
false;
            }
            return 
r;
        }
    }

    
//if handler is not already stored, assign it
    
for(var 0element[listener '_num']; i++)
        if(
element[listener i] == handler)
            return;
    
element[listener element[listener '_num']] = handler;
    
element[listener '_num']++;
};

floatingMenu.init = function()
{
    
floatingMenu.initSecondary();
    
floatingMenu.doFloat();
};

// Some browsers init scrollbars only after
// full document load.
floatingMenu.initSecondary = function()
{
    
floatingMenu.computeShifts();
    
floatingMenu.nextX floatingMenu.calculateCornerX();
    
floatingMenu.nextY floatingMenu.calculateCornerY();
    
floatingMenu.move();
}

if (
document.layers)
    
floatingMenu.addEvent(window'onload'floatingMenu.init);
else
{
    
floatingMenu.init();
    
floatingMenu.addEvent(window'onload',
        
floatingMenu.initSecondary);
}

//--></script>
<!-- /FLOATING MENU -->

<!-- 
content table -->
$spacer_open

$_phpinclude_output

$ad_location
[ad_header_end
The menu is in the good place, but something's wrong.
Can someone please help me out with this?
Greetz,

tijmen_4real
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10135 seconds
  • Memory Usage 2,410KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete