Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Different color for nav/sitetitle on different pages

Different color for nav/sitetitle on different pages

Scheduled Pinned Locked Moved General Discussion
12 Posts 3 Posters 99 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    absent
    wrote on last edited by
    #3

    Thank you very much, I understand. I'm sorry, I forgot to clarify – I would like to change the "first row" nav/sitetitle BLACK and the following rows to WHITE links.

    Would this be possible?

    A 1 Reply Last reply
    0
    • A absent

      Thank you very much, I understand. I'm sorry, I forgot to clarify – I would like to change the "first row" nav/sitetitle BLACK and the following rows to WHITE links.

      Would this be possible?

      A Offline
      A Offline
      alasdair17
      wrote on last edited by
      #4

      @absent do you have a link to your website so I can see? sounds like it should be possible!

      1 Reply Last reply
      0
      • A Offline
        A Offline
        absent
        wrote on last edited by
        #5

        My version is still on a local environment. I found this code in your forum, but isn't working 100% for me.

        I add on the first row ".darkrow" as css class to make the nav/sitetitle black.

        .white
        {
        color: #fff !important;
        }
        
        <script>
            var offset = 50;
            var $blackRows;
            var $nav;
            
            window.laytheme.on("newpageshown", function(layoutObj, type, obj){
                $blackRows = jQuery(".darkrow");
                $nav = jQuery("nav a, .sitetitle span");
                $nav.addClass("white");
            });
            
            jQuery(document).on("scroll", function(){
                $blackRows.each(function(){
                    var rect = this.getBoundingClientRect();
                    if(rect.top - offset < 0 && rect.bottom - offset > 0){
                        $nav.removeClass("white");
                        return false;
                    }else{
                        $nav.addClass("white");
                    }
                });
            });
        </script>
        
        1 Reply Last reply
        0
        • A Offline
          A Offline
          alasdair17
          wrote on last edited by alasdair17
          #6

          hmm could you explain a bit further about what you mean when you say "first row" in relation to the navbar?

          it sounds like more than just the navbar/site title/menu item colours you want to change?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            absent
            wrote on last edited by
            #7

            I only want to change the sitetitle and navigation color from white to black (based in the row color that I define with ".darkrow"). I'm not sure if this is (easy) possible?

            intro.jpg

            1 Reply Last reply
            0
            • arminunruhA Offline
              arminunruhA Offline
              arminunruh
              Global Moderator
              wrote on last edited by arminunruh
              #8

              for rows for example, you can right click them in the gridder, click "set row html class and id" and add this class:

              white

              be65a58a-58ed-4ad4-b1b8-f8b103c2cf50-image.png

              now add this to lay options -> custom css & html:

              custom <head> content:

              <script>
              var $canbewhite = false
              
              window.laytheme.on('newpageshown', function () {
              	$canbewhite = jQuery('.white')
              	addOrRemoveWhite()
              })
              
              var offset = 50;
              
              jQuery(document).on('scroll', function () {
              	addOrRemoveWhite()
              })
              
              var addOrRemoveWhite = function () {
              	var isOneWhite = false
              	if (!$canbewhite) return
              	$canbewhite.each(function () {
              		if (this.getBoundingClientRect().top - offset < 0 && this.getBoundingClientRect().bottom - offset > 0) {
              			isOneWhite = true
              		}
              	})
              
              	if (isOneWhite) {
              		jQuery('body').addClass('white-header')
              	} else {
              		jQuery('body').removeClass('white-header')
              	}
              }
              </script>
              

              Important, we still need to add this CSS:

              Custom CSS for Desktop Version:

              /* your site title and navigation texts need to be black at first. then we invert them, when "white-header" class is added to the body */
              
              /* invert your site title */
              body.white-header .sitetitle{
              	filter: invert(1);
              }
              
              /* invert your nav */
              body.white-header > .laynav {
                      filter: invert(1);
              }
              

              Custom CSS for Mobile Version:

              /* optional: make mobile site title, burger and cart icon white */
              
              body.white-header .burger-wrap {
              	filter: invert(1);
              }
              body.white-header .lay-cart-icon-wrap {
                   filter: invert(1);
              }
              body.white-header .mobile-title{
              	filter: invert(1);
              }
              
              /* optional: make mobile things black again when mobile menu is opened */
              
              body.white-header.mobile-menu-open .burger-wrap {
              filter: invert(0);
              }
              body.white-header.mobile-menu-open .lay-cart-icon-wrap{
              filter: invert(0);
              }
              body.white-header.mobile-menu-open .mobile-title{
              filter: invert(0);
              }
              
              1 Reply Last reply
              0
              • A Offline
                A Offline
                absent
                wrote on last edited by
                #9

                It works perfect!!! Thank you very much!!!

                1 Reply Last reply
                1
                • arminunruhA Offline
                  arminunruhA Offline
                  arminunruh
                  Global Moderator
                  wrote on last edited by
                  #10

                  i did some changes to the code,

                  for the phone version we also invert the burger, before i set the color: text color

                  this code doesnt inver the menu bar though
                  u can basically use the browser inspector, find out what things you want to invert additionally like if u want to invert the menubar too for example and write ur own css

                  1 Reply Last reply
                  0
                  • arminunruhA Offline
                    arminunruhA Offline
                    arminunruh
                    Global Moderator
                    wrote on last edited by
                    #11

                    i think many people just use
                    https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode

                    mix-blend-mode: difference;

                    on the menu and site title. but then you need to set your menu and site title to be white, and then it uses this difference effect which is an alternative to what we're doing here.

                    I also made a reel about this:

                    https://www.instagram.com/p/Cjm8eHkjiXA/

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      absent
                      wrote on last edited by
                      #12

                      Great, thank you very much. I think this will help many people.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      I also code custom websites or custom Lay features.
                      šŸ’æ Email me here: šŸ’æ
                      info@laytheme.com

                      Before you post:
                      1. When using a WordPress Cache plugin, disable it or clear your cache.
                      2. Update Lay Theme and all Lay Theme Addons
                      3. Disable all Plugins
                      4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                      This often solves issues you might run into

                      When you post:
                      1. Post a link to where the problem is
                      2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                      3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                      Online Users
                      Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                      laytheme.com
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Search