-
AuthorPosts
-
January 12, 2022 at 11:44 am #1335217
Hi,
As a follow up of this post I made :
https://kriesi.at/support/topic/full-width-layer-slider-caption-position/The solution for the full width layer slider
.home #full_slider_1 .avia-slide-wrap, .home #full_slider_1 .av_slideshow_full .av-slideshow-caption { max-height: 570px; }
is not working on resolution below 1920×1080 on desktop. Also not on ipad and iphone.
Can you advice ?Thanks
January 13, 2022 at 3:52 am #1335339Hey marcusss,
Thank you for the inquiry.
The css is actually working correctly, although it doesn’t affect the caption container because it is always shorter than the specified maximum height. Please check the screenshot in the private field.
What are you expecting with the css code above?
Best regards,
IsmaelJanuary 13, 2022 at 10:30 am #1335378Hi Ismael,
My mistake, the CSS I use on the home page slider is :
.home #full_slider_1 .avia-slide-wrap, .home #full_slider_1 .av_slideshow_full .av-slideshow-caption { max-height: 480px; }
It sets the max height for the slider images and makes the caption align in the center, so that is good. However on smaller resolutions and mobile this doesn’t work.
Thanks
January 14, 2022 at 8:10 am #1335524Hi,
Thank you for the info.
It is actually working but you might be confusing max-height with the min-height or the height properties. Please note that the max-height property is used to control the height of an element so that it doesn’t go taller or beyond the specified value. The actual height of the slider doesn’t reach that limit or it doesn’t go taller than 480px on mobile view.
Are you trying to keep the height of the slider to 480px even on smaller screens? Try to replace max-height property with min-height or just height.
Best regards,
IsmaelJanuary 14, 2022 at 11:12 am #1335547Hi Ismael,
The initial problem I had was that the header images were not all the same size, so the slider resulted in changing size during sliding. Then I got the solution of setting the max height according to the smallest image. This way the slider show no weird behaviour when images of different sizes ( higher than 480px ) are used. The CSS code provided by support was to set the caption in ‘ center ‘ position.
Now I see and that this solution does not work on mobile for example. This makes sense actually, because the height of the slider area is much smaller then the 480px set in the avia settings and the custom css.
So my question is; is there some additional fix to prevent the slider from changing height when using different sized imaged, but specially now in the case of mobile or other resolutions where the height is lower than the set 480px.
Hope I explained it correctly .
Thanks in advance.January 16, 2022 at 7:41 pm #1335762Hi,
Thank you for your patience, I disabled the css for the homepage because I came up with another solution, this script calculates the height of each of your slides and makes them all the same height, it needs to be added to the end of your child theme functions.php file in Appearance ▸ Editor, but this option is hidden right now for me so you will need to add it:function custom_script() { ?> <script> (function($){ $(window).load(function(){ $('#top.home #full_slider_1 .avia-slideshow-inner').each(function(){ var $columns = $('li .avia-slide-wrap img',this); var maxHeight = Math.max.apply(Math, $columns.map(function(){ return $(this).height(); }).get()); $columns.height(maxHeight); }); }); var resizeId; window.addEventListener('resize', function() { clearTimeout(resizeId); resizeId = setTimeout(doneResizing, 500); }); function doneResizing(){ location.reload(); } })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
If you don’t know how to enable the theme editor then add this via FTP, or post FTP access in the Private Content area below.
Right now the script will only work on the homepage for you to review, if you approve we can adjust to work on other pages.Best regards,
MikeJanuary 16, 2022 at 10:59 pm #1335787Hi Mike,
I added the code to functions.php
As I can see it seems to work as expected. Can you tell me where I need to set max height when I use this script ?I did not remove the CSS however that did the original fix on the homepage
.home #full_slider_1 .avia-slide-wrap, .home #full_slider_1 .av_slideshow_full .av-slideshow-caption { max-height: 480px; }
Can it be removed ?
For the other pages I have no slider so its okay as it is now I think. However I would be of course interested in code for other pages than the home page as this might be a needed fix for the future.
Thanks in advance.
January 16, 2022 at 11:17 pm #1335793Hi,
I believe you mean that you added it to your live site and not the site I have assess to, I forgot it was not your live site.
Please remove the css for the home page, and check, the script automatically sets equal size for all home sliders this way the size is always correct no matter the screen size, otherwise you would need to set different sizes for mobile, tablet, laptop, & desktop.Best regards,
MikeJanuary 16, 2022 at 11:29 pm #1335795Hi Mike,
I removed the CSS.
The script works as expected on all resolutions, also the smaller/mobile ones.
However, setting the max height on full size browser window as done by the css is now removed. It looks like maybe combining the CSS and the script, handles
-1 full page max height by CSS and
-2 equal ” responsive heights ‘ by script for smaller browser windows/mobile devices.
Is this correct ?I do see for the other pages then the home page the header is changing size still ( but this was expected as you told the script only works for home page slider right now ). Please see links attached.
Thanks
January 16, 2022 at 11:55 pm #1335796Hi,
Perhaps I misunderstand your goal, the slider you are using is the full slider so it is meant to be this large for desktops, if you want to use the css with the script you can, I was trying to help correct the issue with the other device sizes and had hoped to create a solution for all sizes.Best regards,
MikeJanuary 17, 2022 at 12:42 am #1335803Hi Mike,
You did help me out with a solution. Sorry for the confusion.
The CSS now seems like an extra to make the slider a bit smaller on the home page.
The script you provided works perfect to fix the changing of size on mobile devices. This is perfect, thanks.Do you have a fix for the non-home pages so the size stays the same ?
Thanks a lot in advanceJanuary 17, 2022 at 6:13 am #1335826Hi,
Do you have a fix for the non-home pages so the size stays the same ?
Have you tried applying custom ID or class names to the sliders? You can use those attributes to directly modify an element with css or a custom script. If you haven’t done this before, please edit one of the sliders, go to the Advanced > Developer Settings toggle, then input your preferred custom ID or class name in the provided fields.
For example, in the Custom CSS Class field, use “av-transitionintl-slider”, then save the element. We can now use this class name to directly adjust that particular element or slider. In the script that @mike provided above, look for this line..
$('#top.home #full_slider_1 .avia-slideshow-inner').each(function(){
and replace it with..
$('#top .av-transitionintl-slider .avia-slideshow-inner').each(function(){
You may need to adjust the css as well.
.av-transitionintl-slider .avia-slide-wrap, .av-transitionintl-slider .av_slideshow_full .av-slideshow-caption { max-height: 480px; }
You might have noticed that we replaced “.home #full_slider_1” with the new css class name or selector. If you want to adjust the other sliders or apply the same modification to them, just apply the same class name to them “av-transitionintl-slider”, or use a different one and another css for it.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.