vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Miscellaneous Hacks - The Up/Down buttons (https://vborg.vbsupport.ru/showthread.php?t=264946)

just.b.jealous 06-08-2011 10:00 PM

The Up/Down buttons
 
1 Attachment(s)
* 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.



http://img101.imageshack.us/img101/2819/arrowsp.png


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?
http://img12.imageshack.us/img12/5894/updownt.jpg


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...


http://img41.imageshack.us/img41/2572/arrowupu.pnghttp://img13.imageshack.us/img13/2614/arrowdowng.png

ttran 06-09-2011 04:39 PM

Nice, Thanks :)

giorgino 06-09-2011 06:33 PM

Any screenshot or demo site? :)

Special Pages 06-09-2011 10:01 PM

^ Yeah that's what I want too.

Manoel J?nior 06-09-2011 10:37 PM

Screenshot please

just.b.jealous 06-10-2011 01:40 AM

Quote:

Originally Posted by ttran (Post 2205502)
Nice, Thanks :)

You're welcome and I'm glad someone found it useful.

Quote:

Quote:

Originally Posted by giorgino (Post 2205550)
Any screenshot or demo site? :)

Quote:

Originally Posted by Special Pages (Post 2205600)
^ Yeah that's what I want too.

Quote:

Originally Posted by Manoel J?nior (Post 2205615)
Screenshot please


Added a screen shot to the first post.

doctorsexy 06-12-2011 12:02 PM

Very nice..thanks

COL NIL SATIS 06-14-2011 11:30 AM

Sweet

just.b.jealous 06-15-2011 04:48 AM

Quote:

Originally Posted by doctorsexy (Post 2206611)
Very nice..thanks

No probs, you're welcome.

RobbieZ 08-18-2011 09:25 AM

Can this be changed or added : Scroll to Bottom ?

just.b.jealous 08-18-2011 03:17 PM

Quote:

Originally Posted by RobbieZ (Post 2234885)
Can this be changed or added : Scroll to Bottom ?

Yup, updated it to have both buttons,..

1 button to go Up.
1 button to go Down.

If you only need one of the buttons- just edit the coding where I've marked everything accordingly. Basically just remove the half of the code you do not want. If you're only using 1- you'll have to adjust the settings for "right:?px" and "bottom:0px".

RobbieZ 08-19-2011 07:25 AM

Woohoo Installed :D

RobbieZ 08-19-2011 07:06 PM

Is there anyway to call to an image instead of the 'boxed' up and down buttons?

Thanks

victorvu 08-28-2011 07:22 PM

Quote:

Originally Posted by RobbieZ (Post 2235504)
Is there anyway to call to an image instead of the 'boxed' up and down buttons?

Thanks

I am thinking the same thing, such as arrow icon up and arrow icon down.

Cheers,

Victor:up:

Dragaon 09-08-2011 05:46 PM

Sorry to be the 1st negative report here.
Installed on 4.1.5 pl1 and nothing shows up, no buttons and no errors. zip.

I tried it on various styles as well as the default vb one.

notas_25 09-09-2011 02:36 PM

Quote:

Originally Posted by Dragaon (Post 2243499)
Sorry to be the 1st negative report here.
Installed on 4.1.5 pl1 and nothing shows up, no buttons and no errors. zip.

I tried it on various styles as well as the default vb one.

Same for me, desinstalled

Digital Jedi 09-09-2011 03:06 PM

Quote:

Originally Posted by Dragaon (Post 2243499)
Sorry to be the 1st negative report here.
Installed on 4.1.5 pl1 and nothing shows up, no buttons and no errors. zip.

I tried it on various styles as well as the default vb one.

Quote:

Originally Posted by notas_25 (Post 2243927)
Same for me, desinstalled

Try adding the code the end of your headinclude template instead.

Dragaon 09-16-2011 05:48 PM

Quote:

Originally Posted by Digital Jedi (Post 2243950)
Try adding the code the end of your headinclude template instead.

Thanks, was worth a shot but same result. Nothing showing up. using FF and VB 415

Digital Jedi 09-16-2011 05:59 PM

Quote:

Originally Posted by Dragaon (Post 2246885)
Thanks, was worth a shot but same result. Nothing showing up. using FF and VB 415

I know some JavaScript functions I've added to my templates wouldn't work because of the order it was in with other JavaScript codes. Other times there was an incompatibility with them and other functions. You might try moving things around or testing out on a default style with your plugins deactivated.

just.b.jealous 09-24-2011 09:11 AM

Quote:

Originally Posted by Dragaon (Post 2243499)
Sorry to be the 1st negative report here.
Installed on 4.1.5 pl1 and nothing shows up, no buttons and no errors. zip.

I tried it on various styles as well as the default vb one.

Quote:

Originally Posted by notas_25 (Post 2243927)
Same for me, desinstalled

Try adding it to the bottom of 1 of these templates:
header, headinclude, footer, navbar (might work).

Any template that is called on every page should theoretically work without problems.

just.b.jealous 09-24-2011 09:21 AM

Quote:

Originally Posted by RobbieZ (Post 2235504)
Is there anyway to call to an image instead of the 'boxed' up and down buttons?

Thanks

Updated 1st post with instructions,..

RobbieZ 09-24-2011 10:47 AM

Quote:

Originally Posted by just.b.jealous (Post 2249515)
Updated 1st post with instructions,..

Thanks very much, I was using '^' and 'V' lololol

victorvu 09-24-2011 09:52 PM

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:

just.b.jealous 09-24-2011 11:52 PM

Quote:

Originally Posted by victorvu (Post 2249716)
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..

victorvu 09-25-2011 01:25 AM

Quote:

Originally Posted by just.b.jealous (Post 2249753)
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:

RobbieZ 09-26-2011 03:03 PM

Quote:

Originally Posted by just.b.jealous (Post 2249753)
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!

just.b.jealous 10-11-2011 10:37 PM

Quote:

Originally Posted by RobbieZ (Post 2250232)
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

just.b.jealous 10-11-2011 10:40 PM

Quote:

Originally Posted by victorvu (Post 2249774)
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.

justicechick 02-02-2013 06:21 AM

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/


All times are GMT. The time now is 05:06 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.01362 seconds
  • Memory Usage 1,844KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_html_printable
  • (1)bbcode_php_printable
  • (22)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (29)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete