php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Sunday, July 8, 2018

Hide navbar when user starts to scroll the page down using javascript

Hide a navbar when the user starts to scroll the page using javascript

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
body {
margin: 0;
background-color: orange;
font-family: Arial, Helvetica, sans-serif;
#navbar {
background-color: #333;
position: fixed;
top: 0;
width: 100%;
transition: top 0.3s;
#navbar a {
float: left;
display: block;
color: red;
text-align: center;
padding: 15px;
text-decoration: none;
font-size: 17px;
#navbar a:hover {
background-color: green;
color: orange;
<div id="navbar">
<a href="#home">Home</a>
<a href="#news">News</a>
<a href="#news">About Us</a>
<a href="#news">Contact Us</a>
<a href="#news">Sitemap</a>
<div style="padding:15px 15px 2500px;font-size:30px;margin-top:30px;">
<p><b>This example demonstrates how to hide a navbar when the user starts to scroll the page.</b></p>
<p>Scroll down this frame to see the effect!</p>
<p>Scroll up to show the navbar.</p>
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
if (prevScrollpos > currentScrollPos) {
document.getElementById("navbar") = "0";
} else {
document.getElementById("navbar") = "-50px";
prevScrollpos = currentScrollPos;



  1. Thanks for picking out the time to discuss this, I feel great about it and love studying more on this topic. It is extremely helpful for me. Thanks for such a valuable help again. Kohls 30 off coupon code is valid on sitewide purchases but between specific dates every month.


    DPBOSS - Visit India's most trusted SATTA MATKA Website. Check live DPBOSS Matka Result, DPBOSS Kalyan Chart and Play DP BOSS Matka.
    For More Information Visit:-



    Satta matka offer - satta matka, matka, kuber matka, kalyan matka tips, free matka world, sattanumber, dpboss, fix matka result, gali sattanumber.
    For More Information Visit:-

    Satta Matka

  4. I carry on listening to the reports talk about getting free online grant applications so I have been looking around for the most excellent site to get one. Could you tell me please, where could i acquire some? working capital loan

  5. Dưới đây giải đáp những thắc mắc mà nhiều người vẫn thường hay đặt ra trong cuộc sống.
    - Rắn thạch anh có độc không?
    - Rết có độc không?
    - Thạch sùng có độc không?


  6. Nice blog. This blog is very informative.
    please visit- India Vs Srilanka

  7. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.

  8. My brother suggested I might like this website. He was totally right. This post truly made my day. You cann't imagine simply how much time I had spent for this info! Thanks! Stainless Steel Tube

  9. Fantastic post!
    A lot thanks for sharing with us,
    We are again come on your website,
    Thanks and good day,
    Please visit our site,
    Buy logo

  10. I truly like this post!
    A lot thanks for sharing with us,
    We are again come on your website,
    Thanks and good day,
    Please visit our site,
    Buy logo

  11. hi...Top Tutor Bay is one of the most experienced and reliable writing assistance for students in writing essays, research papers, assignments, term papers, and dissertations, PowerPoint presentations, etc.please visit College Essay in UK, USA, Australia

  12. Eyal Nachum - Eyal Nachum is a fintech guru and a director at Bruc Bond. Eyal is the architect of the software that SMEs use to do cross-border payments. Eyal Nachum

  13. Thank you, I appreciate that I getting a lot of good and reliable information from your post. Thanks for sharing such kind of nice and wonderful post.

    Php Web Development Company Bangalore | Website Developer Bangalore | Magento Website Developer Bangalore | Magento Service Provider India

  14. New generation cycles from road races to off road adventures we got it all. Just checkout our new collection of Cyclux, Mountain bikes and geared cycles.

    Geared Bicycle
    Moutain Bike


  16. Due to COVID-19,Many businesses lost their revenue. But Our Digital Marketing Company USA Grow your business in less time. services we provide are design,development,online marketing,business,Web hosting and much more.

  17. Sports bicycles by Avon Cycles are oriented towards riders multi surface versatility, aggressive style and comfortable riding position. Avon Cycles got a wind range og sports, adventure and best high end cycles in India.
    best sports cycles
    Top high end cycls
    best adventure cycle
    sports cycle with gear
    sports cycle online
    avon sports bike
    best high end bike

  18. Yatharth is a super speciality hospitals in Noida (Delhi NCR) . The hospital has made its name as a best hospital in top ten hospitals in delhi within short period of time. It provides high-class facilities and medical treatment for its patients.
    super speciality hospital in delhi ncr
    best hospital in delhi ncr
    top hospitals in delhi ncr
    among top ten hospital in delhi
    among top private hospital in delhi
    best hospital in in delhi ncr
    delhi ncr super speciality hospital
    among top 10 private hospitals in delhi

  19. Yatharth Hospital in Noida(Delhi NCR) is a super speciality hospital. Yatharth Joint replacement and orthopedics is one of the best unit of what yatharth hospital provides facility.
    hospital near delhi ncr
    orthopedic doctor in delhi ncr
    best orthopedic doctor in delhi ncr
    best orthopedic in delhi ncr
    best knee replacement surgeon in ncr
    best orthopaedic doctor in delhi ncr

  20. If you like meeting, sitting and lying with sexy and beautiful girl, I am Alisha Roy, I will be your one stop destination. I am VIP Mumbai, 24 yrs old from Mumbai. Call me to get a date and enjoy with me as best as you can. I will be real buddy to give you the most memorable girlfriend experience. I have the capacity to entertain you in the best possible way irrespective of you are a dejected man, rejected lover, dissatisfied husband or an erotic love seeker. I am ready face any erotic encounter whether you are a simple sensual pleasure seeker or a modern man of supreme sexuality and promising promiscuity. You are sure to get the best Eros entertainment, as I am highly skilled in creative lovemaking and erotic pampering.
    Mumbai Escorts
    Mumbai Escort
    Mumbai Escorts Service
    Mumbai Escorts Agency
    Independent Mumbai Escorts
    Escorts in Mumbai
    Escorts Service in Mumbai
    Independent Escorts in Mumbai
    Mumbai Independent Escorts
    Mumbai Call Girls
    Call Girls in Mumbai
    Escorts Agency in Mumbai
    Mumbai Female Escorts
    Mumbai Model Escorts
    Escorts Mumbai
    Russian Escorts in Mumbai
    Russian Mumbai Escorts

  21. Jaipur City has a lot of fun with relationship Alisha She, you can guide your efforts and effort accordingly, our services available 365 times, we have some other types of buddies, who provide you with the Independent Dating Service Offer Jaipur Town In, if you can like someone else by me, by the way you would have been relationship a lot of girls but going into relationship with me, you will have different views I will get it, because I am different from the models, especially in situation of loving endeavors, then come stress totally free and luxuriate in my youngsters, my youngsters will have an opportunity to perform only, so what is your fortune, So now, on my lifestyle, now you have the right to be your rightful owner for a while, will I be the king you've always dreamt of now, will you become a beggar of my lifestyle, so what about my devisors? If you are also in the list, then will you settle down my lifestyle, see what happens next, but it is so sure, that after knowing so much about me you will not be accepted, and soon you too will be my You will strategy to come nearer, because somewhere, your summer heat will get out of now a times, what is the here we are at you to pick up the device and make contact with me, I am waiting for get in touch with.

    Call Girls in Jaipur | Call Girls in Visakhapatnam | Call Girls in Vijayawada | Call Girls in Aurangabad | Call Girls in Patna | Call Girls in Ajmer | Call Girls in Bikaner

  22. This was an extremely wonderful post. Thanks for providing this info. Willy Wonka Jacket

  23. This was an extremely wonderful post. Thanks for providing this info.
    george michael leather jacket

  24. wow this great however ,I like your post and great pics might be any people dislike in light of the fact that defrent mind all poeple , best endocrinologist doctor in hyderabad

  25. You can take the McAlister’s Deli Survey to help them to make an improvement to their service and get a Free Coupon Code. talktomcalisters enter code


More Posts