Custom Background Module - selecting different image for mobile & tablet view
SOLVE
Hi All,
I've created a custom background module and it's working great. The design team wants the image swapped out for a new image when viewing on mobile and tablets.
Are there fields I could add in the module that would allow for this swap out of images? Does anyone have thoughts or how they would handle this?
for the so called "hero"(your image module) add a margin-bottom or add a margin-top to the content(the rich-text below the "hero").
I recomend to use "scaleable" margin values like em or vh
It should look like this:
.changable-image{
margin-bottom:5vw; - OR - margin-bottom:5em;
}
or
.content{
margin-top:5vh; - OR - margin-bottom:5em; }
Explanation:
em: uses your base font size. e.g: if your base font is 16px(every browser default font-size) the 5em would be 80px vh: calculates the current browser height of the visitor and divides it by X. e.g: If your browser is fullscreen and you have a screen resolution of 1920*1080px(fullHD), then it would be (1080/100)*5 so 54px.
regards,
Anton
tipp: If you're using a theme from the marketplace it should have a class like "container" or "content" with a top and bottom margin(outer spacing of the element) or padding(inner spacing of the element)
for the so called "hero"(your image module) add a margin-bottom or add a margin-top to the content(the rich-text below the "hero").
I recomend to use "scaleable" margin values like em or vh
It should look like this:
.changable-image{
margin-bottom:5vw; - OR - margin-bottom:5em;
}
or
.content{
margin-top:5vh; - OR - margin-bottom:5em; }
Explanation:
em: uses your base font size. e.g: if your base font is 16px(every browser default font-size) the 5em would be 80px vh: calculates the current browser height of the visitor and divides it by X. e.g: If your browser is fullscreen and you have a screen resolution of 1920*1080px(fullHD), then it would be (1080/100)*5 so 54px.
regards,
Anton
tipp: If you're using a theme from the marketplace it should have a class like "container" or "content" with a top and bottom margin(outer spacing of the element) or padding(inner spacing of the element)