plumber-sass | Easy baseline grid with SASS | Style Language library
kandi X-RAY | plumber-sass Summary
kandi X-RAY | plumber-sass Summary
Using a baseline grid on the web is not easy. For every font family and size you have to measure where the letters sit so you can shift the text to the nearest gridline. After this, you have to precariously add margins and paddings to keep the vertical rhythm. Plumber provides a single SASS mixin that does all the hard work for you.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of plumber-sass
plumber-sass Key Features
plumber-sass Examples and Code Snippets
Community Discussions
Trending Discussions on plumber-sass
QUESTION
EDIT: I've simplified the code (below and in fiddle) down to the major problem needed to be solved in hope of creating more readability.
I've implemented Bader's solution for correctly using getBoundingClientRect
value and using document.querySelector
for getting both the class name and the html
tag needed for the function. I'd now like to move on to the last five lines of the code beginning with var = style
.
I've now corrected the math for the final two variables.
→ I'm trying to achieve creating a snapping function for use alongside Plumber, a baseline-grid Sass plugin.
Basically, I have a vertically centered flex item that needs to -- instead of being perfectly centered -- snap in an upward direction to the closest grid line. This will allow me to have a consistent vertical rhythm between slides in a custom mobile-based experience.
I'm using getBoundingClientRect
to calculate the distance between the bottom of an object, and the top of the window.
Then I use Math.floor
to round down to the nearest multiple of my rem value.
Then I use this new value to create a CSS bottom margin on the flex-centered container for the alignment fix.
(Then to finish, I'd like to have this function load on $(document).ready
and on window resize.)
ANSWER
Answered 2018-Aug-28 at 19:20I hope this will help you
Here's the edited fiddle
jsfiddle.net/ztf64mwg/82/
I just edited some variables and fixed some of the errors
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install plumber-sass
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page