-
AuthorPosts
-
March 4, 2022 at 11:37 pm #1343220
Hello Support!
I really like how the Fullwidth Easy Slider strech/scale the picture depends to the screen size.
(I haven´t found this possiblity in “Color Section” so use Fullwidth easy slider)How can i add a “Heading Syle Modern” like i have in Special Heading module to the H3?
It it possible to make the Easy Slider “Fixed” like in the Color section when i choose Styling -> Background Image
March 5, 2022 at 12:28 am #1343223I searched more and found/tried this:
without successMarch 6, 2022 at 12:57 am #1343310Hi,
Thank you for your question and the link to your test page, I removed the image element inside of the color section and add a background image and a special-heading element, the color section had a costom ID of verksamhet-color-section I changed the css to this:#verksamhet-color-section { background-size: cover; }
and I added this script to your functions.php
function custom_script() { ?> <script> function setHeight(el,val){ var box = document.querySelectorAll(el); var i; for(i = 0;i < box.length;i++){ var width = box[i].offsetWidth; var height = width * val; box[i].style.height = height + 'px'; } } setHeight('.avia_desktop #verksamhet-color-section > .container',.40); setHeight('.avia_mobile #verksamhet-color-section > .container',.30); var container = document.querySelector("#verksamhet-color-section"); var inner = document.querySelector("#verksamhet-color-section .av-special-heading"); var inHeight = inner.offsetHeight; container.style.height = window.innerHeight; container.style.width = window.innerWidth; var conHeight = container.offsetHeight; inner.style.marginTop = ((conHeight-inHeight)/2)+'px'; </script> <?php } add_action('wp_footer', 'custom_script');
now on page load the height of the color section is set based on the width of the page, with a different percentage for mobile & desktop, it also centers the special-heading vertically in the color section.
Please note that this works on page load, so if you test by resizing the browser you need to reload the page for each size. This will not affect your users as their screen size will not change after load.
I recommend using a child theme and moving this to it so it won’t be lost in updates.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.