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. Text Color based on current row-background

Text Color based on current row-background

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 380 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.
  • S Offline
    S Offline
    stdhd
    wrote on Feb 21, 2018, 6:09 PM last edited by
    #1

    Hi there,

    I've tried this code to change text based on current row-background and it works for desktop perfect.

    But not on mobile. Can I put the code elsewhere for mobile?

    For testing: I've tried to set Phone Breakpoint to „0“ and it works but not with setting "600“. Is there any easy solution for this?

    var offset = 50;
    var $blackRows;
    var $nav;
    
    Frontend.GlobalEvents.on("newpageshown", function(layoutObj, type, obj){
        $blackRows = jQuery(".blackrow");
        $nav = jQuery("nav");
        $nav.removeClass("white");
    });
    
    jQuery(document).on("scroll", function(){
        $blackRows.each(function(){
            var rect = this.getBoundingClientRect();
            if(rect.top - offset < 0 && rect.bottom - offset > 0){
                $nav.addClass("white");
                return false;
            }else{
                $nav.removeClass("white");
            }
        });
    });
    

    Source: http://laythemeforum.com:4567/topic/699/change-link-color-on-fixed-nav-based-on-current-row-background

    Thanks!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mariusjopen
      Global Moderator
      wrote on Feb 22, 2018, 7:34 PM last edited by
      #2

      Hi @stdhd
      did you try to put it into the other Custom HTML Fields?

      Can you post a link to your website?

      All the best!

      Marius

      www.mariusjopen.world

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stdhd
        wrote on Feb 23, 2018, 9:46 AM last edited by
        #3

        Thank you Marius. Yes tried different Custom HTML Fields. Desktop works fine in all fields. I've send you a chat message with development link.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mariusjopen
          Global Moderator
          wrote on Feb 26, 2018, 12:41 PM last edited by
          #4

          Hehe :-)
          When you add the class via jQuery you add it to the navigation.
          The navigation does not exist on mobile. There we use a different navigation.

          In general it is good to add this kind of classed to the body.
          Then you can use them for all the elements you like.

          I hope that helps!

          Best!

          Marius

          www.mariusjopen.world

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

          1/4

          Feb 21, 2018, 6:09 PM


          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
          S
          Stanlouche
          24 minutes ago
          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.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Recent
          • Tags
          • Popular
          • Users
          • Search