Home › Forums › Porto – Responsive HTML5 Template › Serving Different Desktop and Mobile Images
-
AuthorPosts
-
May 6, 2025 at 8:33 am #10045744
middlemann
ParticipantHello,
Is there a way to serve up a different image for mobile VS desktop?
I would like to be able to do this with the background images for both the parallax sections and the full screen owl carousel sections.Some of the images that look really good on desktop don’t display well on mobile so I would like to serve a different version of the image for mobile.
Please advise – thank you!
May 6, 2025 at 9:05 pm #10045746Support
KeymasterTHe easiest way to do that is creating custom classes for each element you want to change.
Example:
HTML:
Remove image-image and add a class, for example: bgImage1<div class="owl-item position-relative pt-5 bgImage1" style="background-size: cover; background-position: center; background-color: #111;">
CSS:
.bgImage1 { background-image: url(path_to_image) !important; } @media screen and (min-width: 769px) { .bgImage1 { background-image: url(path_to_tablet_image) !important; } } @media screen and (min-width: 1200px) { .bgImage1 { background-image: url(path_to_desktop_image) !important; } }
May 8, 2025 at 7:15 am #10045753middlemann
ParticipantI have a question about the Owl Carousels.
Do they default to the screen size?
Is there a way to make them expand in height beyond the default screen height to accommodate more content?Right now if i add enough text it will get cut off at the bottom.
The carousels don’t expand vertically like a typical section does.
May 8, 2025 at 10:15 pm #10045754Support
KeymasterHi, you can add data-dynamic-height and set style also, here’s an example:
<div id="home" class="owl-carousel owl-carousel-light owl-carousel-light-init-fadeIn owl-theme manual dots-inside dots-horizontal-center show-dots-hover nav-inside nav-inside-plus nav-dark nav-md nav-font-size-md show-nav-hover mb-0" data-plugin-options="{'autoplayTimeout': 7000}" data-dynamic-height="['1200px','1000px','900px','750px','750px']" style="height: 1200px;">
It will set values for different resolutions, you can changes those numbers the way it will look better for your content.
May 9, 2025 at 4:05 am #10045761middlemann
Participantif it’s “dynamic” then it will display different on different screen resolutions right?
so how do I specify which height to display for a given screen resolution?
May 9, 2025 at 4:43 am #10045763Support
Keymasterdata-dynamic-height="['1200px','1000px','900px','750px','750px']"
Fifth Value For Resolution < 575px
Fourth Value For Resolution > 575px and < 768px
Third Value For Resolution > 767px and < 992px
Second Value For Resolution > 991px and < 1200px
First Value For Resolution > 1199px
* You must change those values to match youor content.
May 10, 2025 at 2:52 pm #10045772middlemann
ParticipantYou sent me this:
<div id=”home” class=”owl-carousel owl-carousel-light owl-carousel-light-init-fadeIn owl-theme manual dots-inside dots-horizontal-center show-dots-hover nav-inside nav-inside-plus nav-dark nav-md nav-font-size-md show-nav-hover mb-0″ data-plugin-options=”{‘autoplayTimeout’: 7000}” data-dynamic-height=”[‘1200px’,’1000px’,’900px’,’750px’,’750px’]” style=”height: 1200px;”>
Are you saying that, [‘1200px’,’1000px’,’900px’,’750px’,’750px’] the ‘1200px” corresponds to >1199px and ‘1000px’ corresponds to >991px and <1200px and so on?
May 12, 2025 at 8:30 pm #10045776Support
KeymasterHello, yes, add those values and resize the browser to see how it works.
-
AuthorPosts