Scale Site Title on scroll
-
Hi
I it possible to scale the Site Tile on scroll?
This is the best example i have:
https://kurppahosk.com/work/dustin/I would like to do sort of the same animation on the Site Title (VOLGA) on this site:
https://www.volga.nu/infoBest,
Hans -
Dear Hans @Hans-Pelle
This is possible but you would have to add a little Custom CSS & jQuery in "Lay Options - Custom CSS & HTML"
The Text has its basic CSS properties but at a certain scroll point it gets a class added - in this case its a class called "stuck"
That Class has its own CSS: So when it gets becomes the class 'Stuck" it also gets new CSS along with it
Before the change its:
.sticky-title { vertical-align: text-top; transition: all 0.4s !important; }
Then when the user scroll's CSS is added that overrides the original:
.stuck { position: fixed; left: calc(20% + .4rem); font-size: 1rem; z-index: 1; }
So this is saying - fix the element to the top, calculate the elements position to left-hand of browser, change font-size etc
The ; transition: all 0.4s !important;
Is indeed important - it is what makes the smooth "transition" between the too states - without it, it would just flick from big to small instantly:
https://www.w3schools.com/css/css3_transitions.aspLook into something like this:
https://stackoverflow.com/questions/12558311/add-remove-class-with-jquery-based-on-vertical-scroll& remember when adding JS/jquery you need to wrap your code in a newpage event and change '$' to 'jQuery'
https://laytheme.com/documentation.html#custom-javascriptE.g
window.laytheme.on("newpageshown", function(layoutObj, type, obj){ // INSERT YOUR CODE HERE_____ });
Good Luck Hans -Google is out best friend!
Let me know how you go & thank you for using Lay Theme in 2021Richard
-
Hi @Richard-K
Thank you for your answer. I'll try it out, thanks.
Best,
Hans -
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- 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:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it