Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications

Reply
 
Thread Tools
The Up/Down buttons Details »»
The Up/Down buttons
Version: 2.00, by just.b.jealous just.b.jealous is offline
Developer Last Online: May 2013 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 4.x.x Rating:
Released: 06-08-2011 Last Update: Never Installs: 25
Template Edits
Re-useable Code  
No support by the author.

* Notes : Support provided, but shouldn't be needed. Works on all versions of vB, including older releases.


Description:
Ever get sick of scrolling back to the top of a page? Ever get sick of scrolling to the bottom of the page to get to the link that scrolls back to the top for you? Then this Mod is for you!
With one simple template edit the mod will place 2 stationary arrows at the bottom right-hand corner of all pagess. One arrow to go up, one arrow to go down. The arrows are anchored to your browser window itself, not the web page. Arrows do not move, or glide.






Installation:

Steps

* Upload the arrows images to (FORUM/images/buttons/).

* admincp >> Styles & Templates >> Style Manager >> Theme >> Edit Templates.

* "header" template - Add the following code (after editing "yoursite.com") to the end of the template:

HTML Code:
<!-- Begin Template Mod -- The Up/Down buttons -->
<script type="text/javascript">
function create_up() {
	if(document.body){
		var up = document.createElement('span');
		up.innerHTML = "<img src='http://yoursite.com/images/buttons/Arrow-Up.png' width='32px' height='32px' />";
		var upsty = "opacity:0.7;position:fixed;text-align:right;right:42px;bottom:0px;z-index:50000;";
		up.style.cssText = upsty;
		up.addEventListener('mouseover', function(){ up.style.opacity = 1; }, false);
		up.addEventListener('mouseout', function(){ up.style.opacity = 0.5; }, false);
		up.addEventListener('click', function(){ window.scrollTo(0,0); }, false);
		document.body.appendChild(up);
	}
};
if(self==top) create_up();
function create_down() {
	if(document.body){
		var down = document.createElement('span');
		down.innerHTML = "<img src='http://yoursite.com/images/buttons/Arrow-Down.png' width='32px' height='32px' />";
		var dosty = "opacity:0.7;position:fixed;text-align:right;right:0px;bottom:0px;z-index:50000;";
		down.style.cssText = dosty;
		down.addEventListener('mouseover', function(){ down.style.opacity = 1; }, false);
		down.addEventListener('mouseout', function(){ down.style.opacity = 0.5; }, false);
		down.addEventListener('click', function(){ window.scrollTo(0, document.body.scrollHeight); }, false);
		document.body.appendChild(down);
	}
};
if(self==top) create_down();
</script>
<!-- End Template Mod -- The Up/Down buttons -->
Save and you're finished!


Rather use words instead of pictures?



HTML Code:
<!-- Begin Template Mod -- The Up/Down buttons -->
<script type="text/javascript">
	// Begin Up code.
	function create_up() {
		if(document.body){
			var up = document.createElement('span');
			up.innerHTML = "Up";
			var upsty = "opacity:0.7;position:fixed;text-align:right;right:42px;bottom:0px;z-index:50000;";
			upsty+="border: 2px solid;-moz-border-top-colors: ThreeDLightShadow ThreeDHighlight;-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;-moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;padding: 3px;color: MenuText;background-color: Menu;font-size:9pt;font-family:arial,sans-serif;cursor:pointer;";
			up.style.cssText = upsty;
			up.addEventListener('mouseover', function(){ up.style.opacity = 1; }, false);
			up.addEventListener('mouseout', function(){ up.style.opacity = 0.5; }, false);
			up.addEventListener('click', function(){ window.scrollTo(0,0); }, false);
			document.body.appendChild(up);
		}
	};
	if(self==top) create_up();
	// End Up code.
	//
	// Begin Down code.
	function create_down() {
		if(document.body){
			var down = document.createElement('span');
			down.innerHTML = "Down";
			var dosty = "opacity:0.7;position:fixed;text-align:right;right:0px;bottom:0px;z-index:50000;";
			dosty+="border: 2px solid;-moz-border-top-colors: ThreeDLightShadow ThreeDHighlight;-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;-moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;padding: 3px;color: MenuText;background-color: Menu;font-size:9pt;font-family:arial,sans-serif;cursor:pointer;";
			down.style.cssText = dosty;
			down.addEventListener('mouseover', function(){ down.style.opacity = 1; }, false);
			down.addEventListener('mouseout', function(){ down.style.opacity = 0.5; }, false);
			down.addEventListener('click', function(){ window.scrollTo(0, document.body.scrollHeight); }, false);
			document.body.appendChild(down);
		}
	};
	if(self==top) create_down();
	// End Down code.
</script>
<!-- End Template Mod -- The Up/Down buttons -->
Save and you're finished!

If your forum uses some kind of toolbar that sits at the bottom of pages, ex. Wibiya toolbar, you'll need to edit the following part of the code to suit your needs..

Code:
var c = "opacity:0.7;position:fixed;text-align:right;right:0px;bottom:0px;z-index:50000;";
Usually changing it to something around 25px will do well...


Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
iiioroh, RobbieZ

Comments
  #22  
Old 09-24-2011, 09:21 AM
just.b.jealous just.b.jealous is offline
 
Join Date: Aug 2009
Location: Middle of no where.
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RobbieZ View Post
Is there anyway to call to an image instead of the 'boxed' up and down buttons?

Thanks
Updated 1st post with instructions,..
Reply With Quote
  #23  
Old 09-24-2011, 10:47 AM
RobbieZ RobbieZ is offline
 
Join Date: Jul 2008
Posts: 1,117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by just.b.jealous View Post
Updated 1st post with instructions,..
Thanks very much, I was using '^' and 'V' lololol
Reply With Quote
  #24  
Old 09-24-2011, 09:52 PM
victorvu victorvu is offline
 
Join Date: Mar 2011
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the mod. It is great one.

I installed it and got nothing shows up on my site.

It may have the conflict!

Thanks.

Victor:up:
Reply With Quote
  #25  
Old 09-24-2011, 11:52 PM
just.b.jealous just.b.jealous is offline
 
Join Date: Aug 2009
Location: Middle of no where.
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by victorvu View Post
Thank you for the mod. It is great one.

I installed it and got nothing shows up on my site.

It may have the conflict!

Thanks.

Victor:up:
Try adding it to the bottom of 1 of these:
header, headinclude, footer, or maybe even navbar..
Reply With Quote
  #26  
Old 09-25-2011, 01:25 AM
victorvu victorvu is offline
 
Join Date: Mar 2011
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by just.b.jealous View Post
Try adding it to the bottom of 1 of these:
header, headinclude, footer, or maybe even navbar..
Thanks for the info.

I tried them all with no arrows! Where did they go?

Victor:up:
Reply With Quote
  #27  
Old 09-26-2011, 03:03 PM
RobbieZ RobbieZ is offline
 
Join Date: Jul 2008
Posts: 1,117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by just.b.jealous View Post
Try adding it to the bottom of 1 of these:
header, headinclude, footer, or maybe even navbar..
Im getting load lag on my images, its only seconds, will try other templates to see if it speeds up!
Reply With Quote
  #28  
Old 10-11-2011, 10:37 PM
just.b.jealous just.b.jealous is offline
 
Join Date: Aug 2009
Location: Middle of no where.
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RobbieZ View Post
Im getting load lag on my images, its only seconds, will try other templates to see if it speeds up!

Try and see if this helps- In the coding, where it's:

Code:
http://yoursite.com/images/up.png
change it to:

Code:
./images/up.png
Reply With Quote
  #29  
Old 10-11-2011, 10:40 PM
just.b.jealous just.b.jealous is offline
 
Join Date: Aug 2009
Location: Middle of no where.
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by victorvu View Post
Thanks for the info.

I tried them all with no arrows! Where did they go?

Victor:up:
Try adding it to the top of the template, instead of the bottom. There really shouldn't be any conflicts no matter the mods installed or the difference between vBulletins that people use. The coding is more or less, browser specific- not VB specific. If your browser accepts JavaScript (which all do- unless you've turned it off), then this code should work fine and without errors.
Reply With Quote
  #30  
Old 02-02-2013, 06:21 AM
justicechick justicechick is offline
 
Join Date: Oct 2012
Location: Arkansas
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you have a bar at the bottom you can also make the buttons appear at the top by using the following. I have cometchat at the bottom so I had to alter the code to make it works..

PHP Code:
<!-- Begin Template Mod -- The Up/Down buttons -->
if(
self==topcreate_up();
    
// End Up code.
    //
    // Begin Down code.
    
function create_down() {
        if(
document.body){
            var 
down document.createElement('span');
            
down.innerHTML "Down";
            var 
dosty "opacity:0.7;position:fixed;text-align:right;right:0px;top:0px;z-index:50000;";
            
dosty+="border: 2px solid;-moz-border-top-colors: ThreeDLightShadow ThreeDHighlight;-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;-moz-border-top-colors: ThreeDDarkShadow ThreeDShadow;-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;padding: 3px;color: MenuText;background-color: Menu;font-size:9pt;font-family:arial,sans-serif;cursor:pointer;";
            
down.style.cssText dosty;
            
down.addEventListener('mouseover', function(){ down.style.opacity 1; }, false);
            
down.addEventListener('mouseout', function(){ down.style.opacity 0.5; }, false);
            
down.addEventListener('click', function(){ window.scrollTo(0document.body.scrollHeight); }, false);
            
document.body.appendChild(down);
        }
    };
    if(
self==topcreate_down();
    
// End Down code.
</script>
<!-- 
End Template Mod -- The Up/Down buttons --> 
You can see the results here http://www.theflirtingretreat.com/
Reply With Quote
Reply

Thread Tools

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 03:47 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04494 seconds
  • Memory Usage 2,339KB
  • Queries Executed 25 (?)
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
  • (3)bbcode_code
  • (2)bbcode_html
  • (1)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete