Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

controlling the showing and hiding of the website logo

I don’t have time to write this out for you buddy but it seems like you would have:

  • A hero section with your logo floating inside.

  • A position: fixed; menu style, where you put your menu, search… You will hide this by default.

From here you are able to use a nifty ‘check if in view’ jQuery function. Where you would check if your hero section is in view. TRUE – .hide() menu section. FALSE – .show() menu section.

Then place the ‘check if in view’ function inside an ‘on scroll’ function to refresh when the user moves up and down.

Here is a helpful document (This has been taken from another genius, I simply <3 and adapted the code slightly for my preferences):

(function($) {

    //CHECK SCROLLED INTO VIEW UTIL
    function Utils() {

    }

    Utils.prototype = {
        constructor: Utils,
        isElementInView: function (element, fullyInView) {
            var pageTop = $(window).scrollTop();
            var pageBottom = pageTop + $(window).height();
            var elementTop = $(element).offset().top;
            var elementBottom = elementTop + $(element).height();

            if (fullyInView === true) {
                return ((pageTop < elementTop) && (pageBottom > elementBottom));
            } else {
                return ((elementTop <= pageBottom) && (elementBottom >= pageTop));
            }
        }
    };

    var Utils = new Utils();
    //END CHECK SCROLLED INTO VIEW UTIL

    //USING THE ELEMENT IN VIEW UTIL
    //this function tells what to do do when the element is or isnt in view.
    //var inView = Utils.isElementInView(el, false); Where FALSE means the element doesnt need to be completely in view / TRUE would mean the element needs to be completely in view
    function IsEInView(el) {

        var inView = Utils.isElementInView(el, false);

        if(inView) {

            //console.log('in view');

        } else {
            //console.log('not in view');
        }

    };

    //Check to make sure the element you want to be sure is visible is present on the page
    var variableOfYourElement = $('#variableOfYourElement');

    //if it is on this page run the function that checks to see if it is partially or fully in view
    if( variableOfYourElement.length ) {

        //run function on page load
        IsEInView(variableOfYourElement);

        //run function if the element scrolls into view
        $(window).scroll(function(){

            IsEInView(variableOfYourElement);

        });

    }
    //END USING THE ELEMENT IN VIEW UTIL

})(jQuery);

Related Posts:

  1. JavaScript Loading Screen while page loads
  2. Click button copy to clipboard
  3. How to make html table vertically scrollable
  4. How to make Bootstrap carousel slider use mobile left/right swipe
  5. bootstrap 3 navbar collapse button not working
  6. How to center image in carousel
  7. Can Twitter Bootstrap alerts fade in as well as out?
  8. Play/pause HTML 5 video using JQuery
  9. jQueryUI dialog width
  10. Random background images CSS3
  11. How do I remove a box-shadow effect from an element when another element is hovered?
  12. Slide right to left?
  13. Automatically decrease font size for long words
  14. Best approach for loading a sidebar Only if the screen max-width is >900px?
  15. Twitter Bootstrap Use Collapse in Custom Post Type
  16. Stylizing external SVG files with jQuery and CSS
  17. Gravity list field override and adding javascript [closed]
  18. Add a class to posts in increments of 2
  19. Override theme style with other CSS on a specific page
  20. How can I make this custom menu work?
  21. Remove WordPress scripts
  22. How to make an WordPress element sticky? [closed]
  23. Accordion scrolls page too low after clicking on the title [closed]
  24. show/hide div with simple jQuery script [closed]
  25. What is the propre way to include jQuery UI Datepicker’s CSS in plugin?
  26. Superfish Menu Not Loading
  27. Problem Implementing parallax in header of bp-default theme
  28. Is it OK combined wp-include js, jquery, css? [closed]
  29. jQuery Drill Down iPod Menu FOUC and Selecting Current page
  30. jQuery Validation plugin and Bootstrap 4 CSS classes
  31. Getting click on item to open closest relevant element (popup) with jQuery
  32. How Do I change Markup of a link in WordPress
  33. jQuery for Fade Preload Causes My Site Favicon to Disappear from Tab of Browser
  34. Lightbox scroll page down on iPhone
  35. jQuery function not working in WordPress but works in jsfiddle
  36. Site images are fixed in front of my site content [closed]
  37. WP Media Uploader modal conflicts with Bootstrap modal
  38. :first-child applying to all links [closed]
  39. How to update scrollbar when using Jetpack’s Inifnite Scroller?
  40. Hide input field when second input field is in focus
  41. change the icon of a custom post type in WordPress to use twitter boostrap
  42. Drop Down Category Menu Not Working
  43. How do I add Javascript and CSS files into WordPress?
  44. can’t make jQuery work (change image on time interval) [closed]
  45. JavaScript sleep/wait before continuing [duplicate]
  46. JSON parsing error syntax error unexpected end of input
  47. Why does my JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not?
  48. How to change CSS using jQuery?
  49. How do I link a JavaScript file to a HTML file?
  50. What does [object Object] mean? (JavaScript)
  51. Remove class using jQuery
  52. jQuery $(this) keyword
  53. Why does my JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not?
  54. How to set time delay in javascript
  55. Disable button in jQuery
  56. jQuery $(this) keyword
  57. JavaScript error (Uncaught SyntaxError: Unexpected end of input)
  58. Disable button in jQuery
  59. JavaScript error (Uncaught SyntaxError: Unexpected end of input)
  60. How to wait 5 seconds with jQuery?
  61. Submit a form using jQuery
  62. How to Handle Button Click Events in jQuery?
  63. How can I scroll to an element using jQuery?
  64. How to enable CORS in flask
  65. How can I get the ID of an element using jQuery?
  66. jQuery equivalent of JavaScript’s addEventListener method
  67. Should I use .done() and .fail() for new jQuery AJAX code instead of success and error
  68. Pass request headers in a jQuery AJAX GET call
  69. $.ajax – dataType
  70. what does jQuery data() function do
  71. How to show loading spinner in jQuery?
  72. How can I get the ID of an element using jQuery?
  73. What is content-type and datatype in an AJAX request?
  74. jQuery Selector: Id Ends With?
  75. speedtest.net api
  76. jQuery dialog popup
  77. data.map is not a function
  78. How do you select a particular option in a SELECT element in jQuery?
  79. Set select option ‘selected’, by value
  80. Change Placeholder Text using jQuery
  81. Adding placeholder attribute using Jquery
  82. jQuery Ajax error handling, show custom exception messages
  83. How to send multiple data fields via Ajax?
  84. Adding an onclick function to go to url in JavaScript?
  85. Checking a Url in Jquery/Javascript
  86. Bootstrap Dropdown menu is not working
  87. Jquery change background color
  88. My javascript is returning this error: $.ajax is not a function
  89. Best way to store a key=>value array in JavaScript?
  90. jQuery if div contains this text, replace that part of the text
  91. Javascript Runtime error: $ is undefined
  92. Bootstrap – Uncaught TypeError: Cannot read property ‘fn’ of undefined
  93. Change Background color (css property) using Jquery
  94. jQuery set checkbox checked
  95. JavaScript: filter() for Objects
  96. What is different between $(document).on() and $(element).on()
  97. JavaScript runtime error: ‘$’ is undefined
  98. When and why to ‘return false’ in JavaScript?
  99. How to use jQuery qTip?
  100. Installing jQuery?
Categories jQuery Tags css, jquery, logo
Masking external links with internal link for member-only
Advanced Custom Fields Image Crop

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress