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. Adding a class to the main-region when the footer-region enters the viewport

Adding a class to the main-region when the footer-region enters the viewport

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 422 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.
  • J Offline
    J Offline
    jensdan
    wrote on last edited by
    #1

    Hi

    Thank you for all your great work on this theme!

    I am trying to add/remove a class to the main-region as soon as the the footer-region enters/leaves the viewport. Preferably I would like the main-region to stick to the bottom of the viewport and have the footer-region "slide over" the main-region (e.g. by giving it a class with lover z-index and position fixed to the bottom). I have tried various javascript solutions but have been unable to find any that work.

    Any input and suggestions on how/if this is a achievable would is much appreciated!

    Thx! Jens

    1 Reply Last reply
    0
    • mariusjopenM Offline
      mariusjopenM Offline
      mariusjopen
      Global Moderator
      wrote on last edited by
      #2

      Dear @jensdan
      can you post a link with your tryouts?

      Best!

      Marius

      www.mariusjopen.world

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jensdan
        wrote on last edited by
        #3

        Hi Marius

        Thank you for your answer! I am working locally via mamp, so I don't think it is possible to share my tryouts. But any ideas and inputs would be great! Thanks

        I have http://scrollmagic.io but can't make it work. Do you know if it is possible to use scroll magic with Lay theme?

        I have also tried using various javascripts. E.g. this where I tried using an element in the main-region as a trigger to add a class to the main-region (but I can't make it work like I want to).

        <script>

        jQuery(document).ready(function($) {

        function sticky()
        {
            var window_top=$(window).scrollTop();
            var top_position=$('#sticky-trigger').offset().top;
            var element_to_stick=$('#main-region');
            
            if (window_top > top_position) {
                element_to_stick.addClass('main-region-sticky');
            } else {
                element_to_stick.removeClass('main-region-sticky');
            }
        }
        $(window).scroll(sticky);
        sticky();
        

        });
        </script>

        And then adding this CSS:

        #main-region.main-region-sticky {
        position: fixed;
        bottom: 0;
        }

        1 Reply Last reply
        0
        • mariusjopenM Offline
          mariusjopenM Offline
          mariusjopen
          Global Moderator
          wrote on last edited by
          #4

          Dear @jensdan
          I am not sure if scrollmagic does work with LayTheme.

          LayTheme is a single javascript website:
          http://laytheme.com/documentation.html#custom-javascript

          You might be able to code it for yourself maybe without that plugin?

          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


          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
          M
          Marcal
          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