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

Reply
 
Thread Tools
Sticky Top Bar Details »»
Sticky Top Bar
Version: 1.00, by bjarne2 bjarne2 is offline
Developer Last Online: Nov 2016 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.2.1 Rating:
Released: 05-01-2013 Last Update: Never Installs: 14
 
No support by the author.

I have used the idea and some code from XiTCLUB
This can work in a more simple way and act in the general navbar too.

Template Navbar
*************
as line number 2 paste
<div id="stickyBar">

additional.css
***********
Code:
#stickyBar.stick {
  position: fixed;
  top: 0;
  z-index: 10000;
  width:1200px;
  height:59px;
  margin:0 auto;
  background: #247FB2;
  border-radius: 0 0 0.5em 0.5em;
  display: block;
}
Width is set to the width you have on the side or 100% (my page is width:1200px
Set the height of the Navbar incl submenu (my page Navbar is height:59px
It is important to add the correct px

Template Headinclude
******************
Code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script>
function sticky_relocate() {
  var window_top = $(window).scrollTop();
  var div_top = $('.above_body').offset().top +130;
 
  if (window_top > div_top) {
    $('#stickyBar').addClass('stick');
  } else {
    $('#stickyBar').removeClass('stick');
  }
}

$(function() {
  $(window).scroll(sticky_relocate);
  sticky_relocate();
});
</script>
To get it to work without notch set height down to the navbar (my page is .top +130; in this file in headinclude)
If you use another jquery version is also okay.
It is important to add the correct px

If you use Google Translate disappear the top of the navbar!!


You can see it in action here, but only with this style

http://www.corvetteworld.dk/forums/forum.php?styleid=7

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
JamalFree

Comments
  #2  
Old 05-02-2013, 11:06 AM
New Joe's Avatar
New Joe New Joe is offline
 
Join Date: May 2009
Posts: 1,128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is this the same as this:
https://vborg.vbsupport.ru/showthread.php?t=297532
Reply With Quote
  #3  
Old 05-02-2013, 12:18 PM
bjarne2 bjarne2 is offline
 
Join Date: Dec 2009
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No - here is used standard navbar and not a new!
Reply With Quote
  #4  
Old 05-04-2013, 08:03 AM
GamerPerfection's Avatar
GamerPerfection GamerPerfection is offline
 
Join Date: Feb 2006
Posts: 389
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works, awesome.
http://www.gamerperfection.com/forum.php
Reply With Quote
  #5  
Old 05-04-2013, 11:23 AM
GamerPerfection's Avatar
GamerPerfection GamerPerfection is offline
 
Join Date: Feb 2006
Posts: 389
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Problem - it does not scroll sideways?

i.e. if the browser window is smaller it does not scroll with the page if you move the horizonal bar?
Reply With Quote
  #6  
Old 05-04-2013, 05:07 PM
bjarne2 bjarne2 is offline
 
Join Date: Dec 2009
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you put 171px or so instead of 190px (Headinclude) and your background image in additional.css as the background instead of the dark color it will work better.
Your page will be no less if the browser window is smaller nor!!!
Reply With Quote
  #7  
Old 05-04-2013, 09:01 PM
GamerPerfection's Avatar
GamerPerfection GamerPerfection is offline
 
Join Date: Feb 2006
Posts: 389
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure you understood what I was saying.

If I reduce the width of my browser window so it's less than 1260px (which is the width of the site), then the horizontal scroll bar appears. When I move the horizontal scroll bar the whole site moves with the exception of the sticky navbar.

This is also an issue on smart phones if you view the site and zoom in, then when you move the page horizontally everything moves except the sticky navbar.

So if the window is smaller in width than the navbar when it becomes a sticky navbar you can't see the end of it and therefore can't see the buttons.
Reply With Quote
  #8  
Old 05-05-2013, 06:30 AM
bjarne2 bjarne2 is offline
 
Join Date: Dec 2009
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In additional.css

width:100%;
max-width:1260px;
Reply With Quote
  #9  
Old 05-05-2013, 08:34 AM
GamerPerfection's Avatar
GamerPerfection GamerPerfection is offline
 
Join Date: Feb 2006
Posts: 389
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, that's no good. What that does is it will wrap the navbar so if the window width is reduced anything on the right side will drop underneath, which is fine, but the menu items that drop underneath can't be clicked.

Try it out on my site yourself: http://www.gamerperfection.com

Try it full window, then reduce the window so that the horizontal bar appears and you can see what I mean.

I assume the bar doesn't move with the horizontal scroll because the bar is in a fixed position.
Reply With Quote
  #10  
Old 05-06-2013, 05:33 AM
K4GAP K4GAP is offline
 
Join Date: Mar 2008
Posts: 1,255
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by GamerPerfection View Post
No, that's no good. What that does is it will wrap the navbar so if the window width is reduced anything on the right side will drop underneath, which is fine, but the menu items that drop underneath can't be clicked.

Try it out on my site yourself: http://www.gamerperfection.com

Try it full window, then reduce the window so that the horizontal bar appears and you can see what I mean.

I assume the bar doesn't move with the horizontal scroll because the bar is in a fixed position.
Try using percentage in place of the assigned width.
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 11:31 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.18240 seconds
  • Memory Usage 2,312KB
  • Queries Executed 26 (?)
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
  • (2)bbcode_code
  • (1)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
  • (1)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_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
  • 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