Comments (3)
Hi, @madmouse17
How do I repeat the primary slider in the CSS in one line?
It seems like you're using foreach
loop and want to dynamically add background images. You can do this in one line but every slide in the primary slider also contains some titles and links. However, If you want to dynamically add background images without slide content you can do something like this. I am assuming your banner objects are in the array.
class Banner {
public $image = '';
public function __construct($image = '') {
$this->image = $image;
}
}
$banners = [
new Banner('slide-7.jpg'),
new Banner('slide-8.jpg'),
new Banner('slide-9.jpg')
];
<!--====== Primary Slider ======-->
<div class="s-skeleton s-skeleton--h-640 s-skeleton--bg-grey">
<div class="owl-carousel primary-style-3" id="hero-slider">
@foreach($banners as $banner)
<div class="hero-slide" style="background-image:url({{ asset("images/slider/$banner->image") }})"></div>
@endforeach
</div>
</div>
</div>
<!--====== End - Primary Slider ======-->
But if you want to render the content of the slide too, you can manipulate the array and make a nested array structure that contains the content of the slide and render the HTML markup according to the array structure. Your array structure should be something like this.
$banners = [
0 => [
'image' => $BannerImageInstance1,
'content' => [
'title' => 'Update Your Fashion',
'subtitle '=> '10% Discount on Outwear',
'subtitle2' => 'Find outwear on best prices',
'text' => 'Starting At'
'priceText' => '$100.00',
'linkText' => 'SHOP NOW'
],
1 => [
'image' => $BannerImageInstance2,
'content' => [
'title' => 'Update Your Fashion',
'subtitle '=> '10% Discount on Outwear',
'subtitle2' => 'Find outwear on best prices',
'text' => 'Starting At'
'priceText' => '$100.00',
'linkText' => 'SHOP NOW'
],
2 => [
'image' => $BannerImageInstance3,
'content' => [
'title' => 'Update Your Fashion',
'subtitle '=> '10% Discount on Outwear',
'subtitle2' => 'Find outwear on best prices',
'text' => 'Starting At'
'priceText' => '$100.00',
'linkText' => 'SHOP NOW'
]
]
I hope it is clear now.
from ludus-free-premium-ecommerce-template.
still not responsive, there is a blank page under the banner
bandicam.2021-04-24.19-30-03-174.mp4
from ludus-free-premium-ecommerce-template.
bandicam.2021-04-24.19-25-06-744.mp4
<div class="s-skeleton s-skeleton--h-640 s-skeleton--bg-grey">
<div class="owl-carousel primary-style-3" id="hero-slider">
@foreach ($baner as $banner)
<div class="hero-slide" style="background-image:url({{ asset('baner/thumbnail/'.$banner->image) }})">
</div>
<div></div>
@endforeach
</div>
</div>
banner becomes responsive after adding a div below the banner slide but the next banner is blank
from ludus-free-premium-ecommerce-template.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ludus-free-premium-ecommerce-template.