<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trying to Change Nav Bar color when scrolling down the page after hero image. in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264691#M11865</link>
    <description>&lt;P&gt;Was just taking a peek, and here's what I think the function should be exactly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var topofDiv = $(".hero-image").offset().top; 
var height = $(".hero-image").outerHeight();

$(window).scroll(function(){
    if($(window).scrollTop() &amp;gt; (topofDiv + height)){
        $('.main-nav').addClass('blue');
    }&lt;BR /&gt;    else{&lt;BR /&gt;        $('.main-nav').removeClass('blue');&lt;BR /&gt;    }
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're going to want to delete this old function (which is where the syntax error is coming from) :&lt;/P&gt;&lt;PRE&gt;$(window).scroll(function(){
$('dark-blue').toggleClass('blue', $(this).scrollTop() &amp;gt; 800);
]};&lt;/PRE&gt;</description>
    <pubDate>Thu, 11 Apr 2019 20:22:46 GMT</pubDate>
    <dc:creator>MitchL</dc:creator>
    <dc:date>2019-04-11T20:22:46Z</dc:date>
    <item>
      <title>Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264637#M11852</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi there,&lt;BR /&gt;I am trying to make my webpage template more interactive with some Javascript. One of the things I am trying to do is change the nav bar background once scrolled past the main hero image. I currently have some javascript created but nothing seems to be working. I would love to know if you can lead me to some resources or can help me out.&lt;BR /&gt;&lt;BR /&gt;Preview page:&lt;BR /&gt;&lt;/SPAN&gt;&lt;A href="https://app.hubspot.com/design-previewer/73917/templates/8768636370" target="_blank" rel="noopener"&gt;https://app.hubspot.com/design-previewer/73917/templates/8768636370&lt;/A&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Javascript&amp;amp;colon;&lt;BR /&gt;$(window).scroll(function(){ $('dark-blue').toggleClass('blue', $(this).scrollTop() &amp;gt; 800); ]};&lt;BR /&gt;&lt;BR /&gt;Thanks, Krystal&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 18:09:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264637#M11852</guid>
      <dc:creator>kcarpintieri</dc:creator>
      <dc:date>2019-04-11T18:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264671#M11857</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/91856"&gt;@kcarpintieri&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you post a preview link of the page. The link you've attahced can't be accessed without the account credentials.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 19:40:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264671#M11857</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T19:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264673#M11858</link>
      <description>&lt;P&gt;Hi Mitch,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a preview link:&amp;nbsp;&lt;A href="http://learn.barcoding.com/-temporary-slug-e6b0d6ec-ac7a-47b0-8d6b-abd5bfd93551?hs_preview=erbhUTDF-8825532680" target="_blank"&gt;http://learn.barcoding.com/-temporary-slug-e6b0d6ec-ac7a-47b0-8d6b-abd5bfd93551?hs_preview=erbhUTDF-8825532680&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 19:43:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264673#M11858</guid>
      <dc:creator>kcarpintieri</dc:creator>
      <dc:date>2019-04-11T19:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264676#M11859</link>
      <description>&lt;P&gt;I think something like this should work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var topofDiv = $("#hero-image").offset().top; 
var height = $("#hero-image").outerHeight();

$(window).scroll(function(){
    if($(window).scrollTop() &amp;gt; (topofDiv + height)){
        $('#navigation').addClass('blue');
    }&lt;BR /&gt;    else{&lt;BR /&gt;        $('#navigation').removeClass('blue');&lt;BR /&gt;    }
});

  &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;where "#hero-image" should we switched out for the id or class of your hero image and "#navigation" is your main naviagation&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 19:47:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264676#M11859</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T19:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264684#M11862</link>
      <description>&lt;P&gt;I also noticed that your mobile navigation gets obstructed by your header. You can fix this by adding "&lt;SPAN class="webkit-css-property"&gt;z-index&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="value"&gt;1000&lt;/SPAN&gt;&lt;SPAN&gt;;" to the css of the mobile navigation (#mobile-nav)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:12:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264684#M11862</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T20:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264688#M11864</link>
      <description>&lt;P&gt;Thanks for figuring out the mobile navigation issue - almost forgot about that!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I tried the code you suggested - not sure if it did anything. I'm noticing a syntax error in my inspect panel that might be relating to the javascript. Thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.barcoding.com/-temporary-slug-e6b0d6ec-ac7a-47b0-8d6b-abd5bfd93551?hs_preview=erbhUTDF-8825532680" target="_blank"&gt;https://learn.barcoding.com/-temporary-slug-e6b0d6ec-ac7a-47b0-8d6b-abd5bfd93551?hs_preview=erbhUTDF-8825532680&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:19:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264688#M11864</guid>
      <dc:creator>kcarpintieri</dc:creator>
      <dc:date>2019-04-11T20:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264691#M11865</link>
      <description>&lt;P&gt;Was just taking a peek, and here's what I think the function should be exactly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var topofDiv = $(".hero-image").offset().top; 
var height = $(".hero-image").outerHeight();

$(window).scroll(function(){
    if($(window).scrollTop() &amp;gt; (topofDiv + height)){
        $('.main-nav').addClass('blue');
    }&lt;BR /&gt;    else{&lt;BR /&gt;        $('.main-nav').removeClass('blue');&lt;BR /&gt;    }
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're going to want to delete this old function (which is where the syntax error is coming from) :&lt;/P&gt;&lt;PRE&gt;$(window).scroll(function(){
$('dark-blue').toggleClass('blue', $(this).scrollTop() &amp;gt; 800);
]};&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:22:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264691#M11865</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T20:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264695#M11866</link>
      <description>&lt;P&gt;I'm still not seeing any changes, and I still have an error in the inspect panel:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Uncaught TypeError: $ is not a function&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:28:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264695#M11866</guid>
      <dc:creator>kcarpintieri</dc:creator>
      <dc:date>2019-04-11T20:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264696#M11867</link>
      <description>&lt;P&gt;Hmm, okay try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;jQuery(document).ready(function($){
var topofDiv= $(".hero-image").offset().top;

var height= $(".hero-image").outerHeight();

$(window).scroll(function(){

    if($(window).scrollTop()&amp;gt;(topofDiv+height)){
        $(".main-nav").addClass("blue")
        }else
        {
            $(".main-nav").removeClass("blue")
            }
        });
});&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:30:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264696#M11867</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T20:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264702#M11870</link>
      <description>&lt;P&gt;Okay, that is getting somewhere! Maybe the class just has to be different since it's only around the links? (I want it to be the whole navigation bar where it's the dark blue).&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:39:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264702#M11870</guid>
      <dc:creator>kcarpintieri</dc:creator>
      <dc:date>2019-04-11T20:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264709#M11873</link>
      <description>&lt;P&gt;I'm not sure why this isn't working for you:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var topofDiv = $(".hero-image").offset().top; 
var height = $(".hero-image").outerHeight();
  
$(window).scroll(function(){
    if($(window).scrollTop() &amp;gt; (topofDiv + height)){
        $('.main-nav').addClass('red');
    }
    else{
        $('.main-nav').removeClass('red');
    }
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because here's a quick example I whipped up using this code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://preview.hs-sites.com/_hcms/preview/template/multi?is_buffered_template_layout=true&amp;amp;portalId=519470&amp;amp;tc_deviceCategory=undefined&amp;amp;template_layout_id=8704940324&amp;amp;updated=1555012648520" target="_blank"&gt;https://preview.hs-sites.com/_hcms/preview/template/multi?is_buffered_template_layout=true&amp;amp;portalId=519470&amp;amp;tc_deviceCategory=undefined&amp;amp;template_layout_id=8704940324&amp;amp;updated=1555012648520&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:49:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264709#M11873</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T20:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264715#M11875</link>
      <description>&lt;P&gt;I think it is working - it's just not applying to the entire navigation&amp;nbsp;bar.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GeekCenter-capture.JPG" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/16521i36AF20AFF8359BB4/image-size/large?v=v2&amp;amp;px=999" role="button" title="GeekCenter-capture.JPG" alt="GeekCenter-capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:02:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264715#M11875</guid>
      <dc:creator>kcarpintieri</dc:creator>
      <dc:date>2019-04-11T21:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264719#M11877</link>
      <description>&lt;P&gt;Okay, I see why. That small section is wrapped with the "main-nav" class, while the whole nav is wrapped with "main-nav," (with a comma on the end). Is this a typo in the template editor?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:09:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264719#M11877</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T21:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264720#M11878</link>
      <description>&lt;P&gt;Yeah I can confirm that the navigation has two classes with commas (typos) on the end:&amp;nbsp;"main-nav," and "blue,".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So removing the comma ton make it "main-nav" will get it to work; however, it will make the styling from the smaller "main-nav" apply to the whole thing - which includes being hidden on mobile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; complete solution would be to remove the "main-nav," and "blue," classes from the whole nav and then apply a different class like "main-nav-wrapper".&amp;nbsp; Then change the jquery function to:&lt;/P&gt;&lt;PRE&gt;jQuery(document).ready(function($){
var topofDiv= $(".hero-image").offset().top;

var height= $(".hero-image").outerHeight();

$(window).scroll(function(){

    if($(window).scrollTop()&amp;gt;(topofDiv+height)){
        $(".main-nav-wrapper").addClass("blue")
        }else
        {
            $(".main-nav-wrapper").removeClass("blue")
            }
        });
});&lt;/PRE&gt;&lt;P&gt;Then you should be good to go.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:15:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264720#M11878</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T21:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264722#M11879</link>
      <description>&lt;P&gt;Wooo! Problem solved - thanks!! Have a great day!&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.hubspot.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:18:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264722#M11879</guid>
      <dc:creator>kcarpintieri</dc:creator>
      <dc:date>2019-04-11T21:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264726#M11880</link>
      <description>&lt;P&gt;You betcha! I also may have led you astray with the mobile menu solution. I don't think theres a way to close it right now haha.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:26:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264726#M11880</guid>
      <dc:creator>MitchL</dc:creator>
      <dc:date>2019-04-11T21:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Change Nav Bar color when scrolling down the page after hero image.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264807#M11884</link>
      <description>&lt;P&gt;Do you know how to fix that?!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 11:51:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-Change-Nav-Bar-color-when-scrolling-down-the-page/m-p/264807#M11884</guid>
      <dc:creator>kcarpintieri</dc:creator>
      <dc:date>2019-04-12T11:51:35Z</dc:date>
    </item>
  </channel>
</rss>

