Text Element Sticky: stick to top on scroll
-
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
-
Hi Taemin,
this is possible but not a default function from Laytheme.
You need to do that with a little jQuery.
:-)
Are you familiar with simple Javascript?
Many wishes!
Marius
-
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-javascriptMany wishes!
Marius
-
Hi!
I have tried this but not succeeded:
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 -
Dear @ccastells
you can add a CUSTOM CLASS to the element and give it a position: fixed.All the best!
Marius
-
Dear @ccastells
you can add a CUSTOM CLASS to the element and give it a position: fixed.All the best!
Marius
@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-2Any idea on how can I fix this?
Thanks,
Carlota -
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
-
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
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-2Thanks,
Carlota -
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
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