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. Text Element Sticky: stick to top on scroll

Text Element Sticky: stick to top on scroll

Scheduled Pinned Locked Moved General Discussion
9 Posts 3 Posters 2.2k Views 1 Watching
  • 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.
  • yoontaeminY
    yoontaeminY
    yoontaemin
    wrote on last edited by
    #1

    Hi!

    Is it possible to assign a sticky function to a text element?

    On scroll, the text element should stick to the top when it hits the top.

    Cheers!

    taemin

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

      Hi Taemin,

      this is possible but not a default function from Laytheme.

      You need to do that with a little jQuery.

      http://bfy.tw/5nDR

      :-)

      Are you familiar with simple Javascript?

      Many wishes!

      Marius

      www.mariusjopen.world

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

        Ok, I am not that mean:

        jQuery(document).ready(function($) {
        
            function sticky()
            {
                var window_top=$(window).scrollTop();
                var top_position=$('body').offset().top;
                var element_to_stick=$('#header');
                
                if (window_top > top_position) {
                    element_to_stick.addClass('sticky');
                } else {
                    element_to_stick.removeClass('sticky');
                }
            }
            $(window).scroll(sticky);
            sticky();
            
        });
        
        #header.sticky
        {
            position: fixed;
        }
        

        Have also a look here:
        http://laytheme.com/documentation.html#custom-javascript

        Many wishes!

        Marius

        www.mariusjopen.world

        1 Reply Last reply
        1
        • C
          C
          ccastells
          wrote on last edited by
          #4

          Hi!

          I have tried this but not succeeded:

          http://andrei-lascu.com/info

          I would like to have the Contact text block and the image stick to their original position and have only the middle grid scroll up.

          I have also tried with a simple position:fixed, and did not work.

          Can you please help me out?

          Thanks!
          Carlota

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

            Dear @ccastells
            you can add a CUSTOM CLASS to the element and give it a position: fixed.

            All the best!

            Marius

            www.mariusjopen.world

            C 1 Reply Last reply
            0
            • mariusjopenM mariusjopen

              Dear @ccastells
              you can add a CUSTOM CLASS to the element and give it a position: fixed.

              All the best!

              Marius

              C
              C
              ccastells
              wrote on last edited by
              #6

              @mariusjopen said in Text Element Sticky: stick to top on scroll:

              position: fixed

              Hi Marius,

              unfortunately with the position:fixed it also does not work.
              https://andrei-lascu.com/info-2

              Any idea on how can I fix this?

              Thanks,
              Carlota

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

                Dear @ccastells
                if I look at your page I do not completely understand which part should move and which part should stay fixed on the page.

                Best!

                Marius

                www.mariusjopen.world

                C 1 Reply Last reply
                0
                • mariusjopenM mariusjopen

                  Dear @ccastells
                  if I look at your page I do not completely understand which part should move and which part should stay fixed on the page.

                  Best!

                  Marius

                  C
                  C
                  ccastells
                  wrote on last edited by
                  #8

                  @mariusjopen

                  Hi Marius,

                  I would like the column in the middle to scroll, and have the left and right fixed.
                  https://andrei-lascu.com/info/

                  I tried the position:fixed in this other link to show that this does not work either:
                  https://andrei-lascu.com/info-2

                  Thanks,
                  Carlota

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

                    Dear @ccastells

                    here a very rough sketch. Hope it brings you in the right direction :-)

                    .no-parallax.no-offset.col.push-0.span-2.align-top {
                        position: fixed;
                    }
                    
                    .no-parallax.has-offset.col.push-0.span-2.align-top {
                        position: fixed;
                        right: 20px;
                    }
                    
                    .has-parallax.no-offset.col.push-0.span-3.align-bottom {
                        padding-left: 30%;
                    }
                    
                    

                    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
                    L
                    lukas123
                    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