Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • 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 738 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
    J
    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
      mariusjopenM
      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
        J
        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
          mariusjopenM
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          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