Hi, I need some help for creating a custom module for dynamic text over banner images in landing pages. I have referred to a HubSpot blog post to create the custom module: Adding a Full-width Banner to Your Page [Support Series]. The post had some coding in HTML and CSS. The module has been tested in a landing page and its functional, I am able to get readable and editable text over banner images in multiple widths. However, I have a trouble when i use this same module in othe landing pages with different images.
Is there a way to create a fixed custom module which can be used in multiple pages without cloning the module for each page? Also, ensuring that text changes done on one page doesnt reflect in other pages where the same module has been used.
The module should give me an option to choose any background image and place any text/copy over it, editable when required.
Thank you.
Here is the module code:
<div class=“custom-banner-image”>
<div class=“banner-overlay”></div>
<div class=“banner-text”>
<div class=“page-center”>
<div>
{% inline_rich_text field=“richtext_field” value=“{{ module.richtext_field }}” %}
</div>
</div>
</div>
</div>
{% require_css %}
<style>
.custom-banner-image {
background-image: url(‘https://info.absolutdata.com/hubfs/Foodservices_Blank%20Banner.png’);
}
</style>
{% end_require_css %}
CSS:
.custom-banner-image {
background-repeat: no-repeat;
background-size: cover;
background-position: 50% 50%;
position: relative;
width: 1279px;
height: 363px;
display: block;
}
.custom-banner-image .banner-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.custom-banner-image .banner-text {
padding: 50px 0;
color: #eee;
text-align: center;
position: relative;
z-index: 1;
width: 100%;
font-family: sans-serif;
}
.custom-banner-image .banner-text{
color: #fff;
}
@media (max-width: 767px){
.header-container.container-fluid .row-fluid .page-center {
padding: 0;
}
.custom-banner-image .banner-text {
padding: 50px 15px;
}
}