Industries Slider Button Design
May 5, 2025 · AI Conversations
– A **bottom pink line** is shown initially.
– On hover, the pink line **animates upward**, filling the entire button with the same pink color.
– The text color changes to white during hover for better visibility.
This is achieved using `::before` pseudo-element and smooth CSS transitions.
—
### ✅ Full Updated Code
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class IndustriesSlider_Widget extends ElementorWidget_Base {
public function get_name() {
return 'industries_slider';
}
public function get_title() {
return __( 'Industries Slider', 'gentium' );
}
public function get_icon() {
return 'eicon-slider-push';
}
public function get_categories() {
return [ 'general' ];
}
protected function _register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'Slides', 'gentium' ),
'tab' => ElementorControls_Manager::TAB_CONTENT,
]
);
$repeater = new ElementorRepeater();
$repeater->add_control(
'slide_image',
[
'label' => __( 'Image', 'gentium' ),
'type' => ElementorControls_Manager::MEDIA,
'default' => [
'url' => ElementorUtils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'button_text',
[
'label' => __( 'Button Text', 'gentium' ),
'type' => ElementorControls_Manager::TEXT,
'default' => __( 'Learn More', 'gentium' ),
]
);
$repeater->add_control(
'button_link',
[
'label' => __( 'Button Link', 'gentium' ),
'type' => ElementorControls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'gentium' ),
'show_external' => true,
]
);
$this->add_control(
'slides',
[
'label' => __( 'Slides', 'gentium' ),
'type' => ElementorControls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [],
'title_field' => '{{{ button_text }}}',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( empty( $settings['slides'] ) ) return;
?>
<!-- Swiper CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<div class="industries-slider-wrapper">
<div class="industries-slider swiper">
<div class="swiper-wrapper">
<?php foreach ( $settings['slides'] as $slide ) : ?>
<div class="swiper-slide">
<img class="industries-slide-image" src="<?php echo esc_url( $slide['slide_image']['url'] ); ?>" alt="" />
<a class="industries-button"
href="<?php echo esc_url( $slide['button_link']['url'] ); ?>"
<?php echo $slide['button_link']['is_external'] ? 'target="_blank"' : ''; ?>>
<?php echo esc_html( $slide['button_text'] ); ?>
</a>
</div>
<?php endforeach; ?>
</div>
<!-- Navigation Arrows -->
<div class="industries-slider-navigation">
<div class="industries-button-prev swiper-button-prev"></div>
<div class="industries-button-next swiper-button-next"></div>
</div>
</div>
</div>
<!-- Swiper JS -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px;
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0px 50px 50px 0px;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
z-index: 1;
transition: color 0.4s ease;
}
.industries-button::before {
content: "";
position: absolute;
left: 0;
bottom: 0;
height: 4px;
width: 100%;
background-color: #f13d68;
z-index: -1;
transition: height 0.4s ease;
}
.industries-button:hover::before {
height: 100%;
}
.industries-button:hover {
color: #fff;
}
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 10px;
}
.industries-button-prev,
.industries-button-next {
background: #f13d68;
color: #fff;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.industries-button-prev::after,
.industries-button-next::after {
font-size: 16px;
font-weight: bold;
}
</style>
<?php
}
}
—
Let me know if you'd like to add animation delays or effects like text sliding in too.
<script>
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px; /* More space for arrows */
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0px 50px 50px 0px;
font-size: 20px;
font-weight: 500;
min-width: 90%;
}
/* Navigation Arrows Bottom Center */
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
}
.industries-button-prev,
.industries-button-next {
background: #f13d68;
color: #fff;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.industries-button-prev::after,
.industries-button-next::after {
font-size: 16px;
font-weight: bold;
}
</style>
– A **50px wide pink line** is placed at the bottom of the button.
– On hover, the pink fills the entire button smoothly using a pseudo-element transition.
### ✅ Updated Changes Summary:
– Added a `::before` pseudo-element to `.industries-button` for the initial line.
– On hover, it expands smoothly to fill the button background.
– Also added a `z-index` and `position: relative` to keep text above the background fill.
—
### ✅ Full Updated Code (Only modified `render()` section with new styles)
Replace your existing `render()` method with the following updated one:
protected function render() {
$settings = $this->get_settings_for_display();
if ( empty( $settings['slides'] ) ) return;
?>
<!-- Swiper CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<div class="industries-slider-wrapper">
<div class="industries-slider swiper">
<div class="swiper-wrapper">
<?php foreach ( $settings['slides'] as $slide ) : ?>
<div class="swiper-slide">
<img class="industries-slide-image" src="<?php echo esc_url( $slide['slide_image']['url'] ); ?>" alt="" />
<a class="industries-button"
href="<?php echo esc_url( $slide['button_link']['url'] ); ?>"
<?php echo $slide['button_link']['is_external'] ? 'target="_blank"' : ''; ?>>
<?php echo esc_html( $slide['button_text'] ); ?>
</a>
</div>
<?php endforeach; ?>
</div>
<!-- Navigation Arrows -->
<div class="industries-slider-navigation">
<div class="industries-button-prev swiper-button-prev"></div>
<div class="industries-button-next swiper-button-next"></div>
</div>
</div>
</div>
<!-- Swiper JS -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px;
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0px 50px 50px 0px;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
position: relative;
z-index: 1;
transition: color 0.3s ease;
}
.industries-button::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
height: 100%;
width: 50px;
background: #f13d68;
z-index: -1;
transition: width 0.4s ease;
border-radius: 0px 50px 50px 0px;
}
.industries-button:hover::before {
width: 100%;
}
.industries-button:hover {
color: #fff;
}
/* Navigation Arrows */
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
}
.industries-button-prev,
.industries-button-next {
background: #f13d68;
color: #fff;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.industries-button-prev::after,
.industries-button-next::after {
font-size: 16px;
font-weight: bold;
}
</style>
<?php
}
—
Would you like the Swiper styles or button animations to be converted into separate CSS classes instead of inline for better maintainability?
<script>
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px; /* More space for arrows */
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0px 50px 50px 0px;
font-size: 20px;
font-weight: 500;
min-width: 90%;
}
/* Navigation Arrows Bottom Center */
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
}
.industries-button-prev,
.industries-button-next {
background: #f13d68;
color: #fff;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.industries-button-prev::after,
.industries-button-next::after {
font-size: 16px;
font-weight: bold;
}
</style>
—
### ✅ Full Code: `IndustriesSlider_Widget.php`
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class IndustriesSlider_Widget extends ElementorWidget_Base {
public function get_name() {
return 'industries_slider';
}
public function get_title() {
return __( 'Industries Slider', 'gentium' );
}
public function get_icon() {
return 'eicon-slider-push';
}
public function get_categories() {
return [ 'general' ];
}
protected function _register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'Slides', 'gentium' ),
'tab' => ElementorControls_Manager::TAB_CONTENT,
]
);
$repeater = new ElementorRepeater();
$repeater->add_control(
'slide_image',
[
'label' => __( 'Image', 'gentium' ),
'type' => ElementorControls_Manager::MEDIA,
'default' => [
'url' => ElementorUtils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'button_text',
[
'label' => __( 'Button Text', 'gentium' ),
'type' => ElementorControls_Manager::TEXT,
'default' => __( 'Learn More', 'gentium' ),
]
);
$repeater->add_control(
'button_link',
[
'label' => __( 'Button Link', 'gentium' ),
'type' => ElementorControls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'gentium' ),
'show_external' => true,
]
);
$this->add_control(
'slides',
[
'label' => __( 'Slides', 'gentium' ),
'type' => ElementorControls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [],
'title_field' => '{{{ button_text }}}',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( empty( $settings['slides'] ) ) return;
?>
<!-- Swiper CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<div class="industries-slider-wrapper">
<div class="industries-slider swiper">
<div class="swiper-wrapper">
<?php foreach ( $settings['slides'] as $slide ) : ?>
<div class="swiper-slide">
<img class="industries-slide-image" src="<?php echo esc_url( $slide['slide_image']['url'] ); ?>" alt="" />
<a class="industries-button"
href="<?php echo esc_url( $slide['button_link']['url'] ); ?>"
<?php echo $slide['button_link']['is_external'] ? 'target="_blank"' : ''; ?>>
<?php echo esc_html( $slide['button_text'] ); ?>
</a>
</div>
<?php endforeach; ?>
</div>
<!-- Navigation Arrows -->
<div class="industries-slider-navigation">
<div class="industries-button-prev swiper-button-prev"></div>
<div class="industries-button-next swiper-button-next"></div>
</div>
</div>
</div>
<!-- Swiper JS -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px;
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0px 50px 50px 0px;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
position: relative;
z-index: 1;
transition: color 0.3s ease;
}
.industries-button::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
height: 100%;
width: 50px;
background: #f13d68;
z-index: -1;
transition: width 0.4s ease;
border-radius: 0px 50px 50px 0px;
}
.industries-button:hover::before {
width: 100%;
}
.industries-button:hover {
color: #fff;
}
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
}
.industries-button-prev,
.industries-button-next {
background: #f13d68;
color: #fff;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.industries-button-prev::after,
.industries-button-next::after {
font-size: 16px;
font-weight: bold;
}
</style>
<?php
}
}
—
Let me know if you want the same animation with delay, gradient, or for a circular button style as well.
—
### 🎯 What You Asked:
– The button shows a **50px wide pink line at the bottom** initially.
– On hover, that line **animates to fill the entire button background**.
– The **animation should appear like the pink color is growing upwards or spreading from that bottom line**, creating a *“filling”* effect.
—
### ✅ Here's What I've Done Now:
– Added a `::after` pseudo-element **at the bottom** of the button (`height: 4px`, `width: 50px` initially).
– On hover, it **animates upward** to `height: 100%` and `width: 100%`.
– Added `z-index` layering to keep text on top and animate background underneath.
—
### ✅ Full Working Code Below:
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class IndustriesSlider_Widget extends ElementorWidget_Base {
public function get_name() {
return 'industries_slider';
}
public function get_title() {
return __( 'Industries Slider', 'gentium' );
}
public function get_icon() {
return 'eicon-slider-push';
}
public function get_categories() {
return [ 'general' ];
}
protected function _register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'Slides', 'gentium' ),
'tab' => ElementorControls_Manager::TAB_CONTENT,
]
);
$repeater = new ElementorRepeater();
$repeater->add_control(
'slide_image',
[
'label' => __( 'Image', 'gentium' ),
'type' => ElementorControls_Manager::MEDIA,
'default' => [
'url' => ElementorUtils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'button_text',
[
'label' => __( 'Button Text', 'gentium' ),
'type' => ElementorControls_Manager::TEXT,
'default' => __( 'Learn More', 'gentium' ),
]
);
$repeater->add_control(
'button_link',
[
'label' => __( 'Button Link', 'gentium' ),
'type' => ElementorControls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'gentium' ),
'show_external' => true,
]
);
$this->add_control(
'slides',
[
'label' => __( 'Slides', 'gentium' ),
'type' => ElementorControls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [],
'title_field' => '{{{ button_text }}}',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( empty( $settings['slides'] ) ) return;
?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<div class="industries-slider-wrapper">
<div class="industries-slider swiper">
<div class="swiper-wrapper">
<?php foreach ( $settings['slides'] as $slide ) : ?>
<div class="swiper-slide">
<img class="industries-slide-image" src="<?php echo esc_url( $slide['slide_image']['url'] ); ?>" alt="" />
<a class="industries-button"
href="<?php echo esc_url( $slide['button_link']['url'] ); ?>"
<?php echo $slide['button_link']['is_external'] ? 'target="_blank"' : ''; ?>>
<?php echo esc_html( $slide['button_text'] ); ?>
</a>
</div>
<?php endforeach; ?>
</div>
<div class="industries-slider-navigation">
<div class="industries-button-prev swiper-button-prev"></div>
<div class="industries-button-next swiper-button-next"></div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px;
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0 50px 50px 0;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
position: relative;
z-index: 1;
transition: color 0.3s ease;
}
.industries-button::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
height: 4px;
width: 50px;
background: #f13d68;
z-index: 0;
transition: width 0.4s ease, height 0.4s ease;
}
.industries-button:hover::after {
width: 100%;
height: 100%;
}
.industries-button:hover {
color: #fff;
}
.industries-button span {
position: relative;
z-index: 2;
}
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
}
.industries-button-prev,
.industries-button-next {
background: #f13d68;
color: #fff;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.industries-button-prev::after,
.industries-button-next::after {
font-size: 16px;
font-weight: bold;
}
</style>
<?php
}
}
—
### 🧪 Final Result:
– ✅ Initially shows a pink line (`50px wide`, `4px tall`) at the bottom of the button.
– ✅ On hover, that line expands vertically and horizontally to **cover the whole button** with pink.
– ✅ Text remains visible and on top due to `z-index`.
Let me know if you'd like to add easing or delay to make the fill smoother or more dramatic!
please follow my instruction
—
### ❌ Current Issue:
– The **pink fill effect** is a square block.
– It's not matching the **curved (rounded) shape** of the original button (`border-radius: 0 50px 50px 0`).
– Looks abrupt and visually disconnected.
—
### ✅ Fix: Make the Pink Fill Animate **with Curves**
We’ll do this by:
– Ensuring the **hover fill** uses the **same border-radius** as the button.
– Keeping the text **on top** of the fill.
– Making the pink fill animate **from a 50px-wide line at the bottom** into a full background smoothly **with curved shape**.
—
### ✅ Replace the button CSS with the version below:
Update this part in your “ block:
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0 50px 50px 0;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
z-index: 1;
transition: color 0.3s ease;
}
.industries-button::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 50px;
height: 4px;
background: #f13d68;
border-radius: 0 50px 50px 0;
transition: all 0.4s ease;
z-index: 0;
}
.industries-button:hover::before {
width: 100%;
height: 100%;
border-radius: 0 50px 50px 0;
}
.industries-button:hover {
color: #fff;
}
.industries-button span {
position: relative;
z-index: 2;
}
### ✅ And update your button HTML like this:
Replace this line:
<?php echo esc_html( $slide['button_text'] ); ?>
With this line **inside a “**:
<span><?php echo esc_html( $slide['button_text'] ); ?></span>
—
### ✅ Result:
– A pink **rounded fill** grows from a **small curved line at the bottom** to fully fill the button.
– The **text stays white on hover**, and the pink background matches the **rounded shape**.
Let me know if you also want **reverse animation on mouse out** or a **diagonal fill effect**.
– ✅ Starts with a **50px wide pink curved line** at the bottom.
– ✅ On hover, **smoothly fills the entire button** while keeping the **rounded shape**.
– ✅ Text remains **visible and on top** of the animation.
—
### ✅ Full Code: `IndustriesSlider_Widget.php`
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class IndustriesSlider_Widget extends ElementorWidget_Base {
public function get_name() {
return 'industries_slider';
}
public function get_title() {
return __( 'Industries Slider', 'gentium' );
}
public function get_icon() {
return 'eicon-slider-push';
}
public function get_categories() {
return [ 'general' ];
}
protected function _register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'Slides', 'gentium' ),
'tab' => ElementorControls_Manager::TAB_CONTENT,
]
);
$repeater = new ElementorRepeater();
$repeater->add_control(
'slide_image',
[
'label' => __( 'Image', 'gentium' ),
'type' => ElementorControls_Manager::MEDIA,
'default' => [
'url' => ElementorUtils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'button_text',
[
'label' => __( 'Button Text', 'gentium' ),
'type' => ElementorControls_Manager::TEXT,
'default' => __( 'Learn More', 'gentium' ),
]
);
$repeater->add_control(
'button_link',
[
'label' => __( 'Button Link', 'gentium' ),
'type' => ElementorControls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'gentium' ),
'show_external' => true,
]
);
$this->add_control(
'slides',
[
'label' => __( 'Slides', 'gentium' ),
'type' => ElementorControls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [],
'title_field' => '{{{ button_text }}}',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( empty( $settings['slides'] ) ) return;
?>
<!-- Swiper CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<div class="industries-slider-wrapper">
<div class="industries-slider swiper">
<div class="swiper-wrapper">
<?php foreach ( $settings['slides'] as $slide ) : ?>
<div class="swiper-slide">
<img class="industries-slide-image" src="<?php echo esc_url( $slide['slide_image']['url'] ); ?>" alt="" />
<a class="industries-button"
href="<?php echo esc_url( $slide['button_link']['url'] ); ?>"
<?php echo $slide['button_link']['is_external'] ? 'target="_blank"' : ''; ?>>
<span><?php echo esc_html( $slide['button_text'] ); ?></span>
</a>
</div>
<?php endforeach; ?>
</div>
<div class="industries-slider-navigation">
<div class="industries-button-prev swiper-button-prev"></div>
<div class="industries-button-next swiper-button-next"></div>
</div>
</div>
</div>
<!-- Swiper JS -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px;
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0 50px 50px 0;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
z-index: 1;
transition: color 0.3s ease;
}
.industries-button::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 50px;
height: 4px;
background: #f13d68;
border-radius: 0 50px 50px 0;
transition: all 0.4s ease;
z-index: 0;
}
.industries-button:hover::before {
width: 100%;
height: 100%;
border-radius: 0 50px 50px 0;
}
.industries-button:hover {
color: #fff;
}
.industries-button span {
position: relative;
z-index: 2;
}
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
}
.industries-button-prev,
.industries-button-next {
background: #f13d68;
color: #fff;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.industries-button-prev::after,
.industries-button-next::after {
font-size: 16px;
font-weight: bold;
}
</style>
<?php
}
}
—
### 🧪 Visual Result:
– White button with curved right side.
– A **pink curved bar** at the bottom left starts small.
– On hover, it **expands and fills** the full button with the same rounded shape.
– Text remains clearly visible.
Would you like to add a **diagonal wipe effect**, or apply this to other buttons site-wide with a reusable CSS class?
so what you need to do is , make a space of 16px from left at starting , than , it will fill full buttonfrom left and right
also make the arrows same as it is in image!
do it correctly !
—
### ✅ Button Hover Animation Update:
– Starts with a **16px left space** and a small **pink bar**.
– On hover, the pink background fills the **entire button**, maintaining rounded corners and filling **from left to right**.
### ✅ Navigation Arrows Update:
– Circular buttons with **left/right arrows inside** (`←` / `→`).
– Properly centered and styled like your screenshot.
—
### ✅ Full Updated Code (Complete `IndustriesSlider_Widget.php`):
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class IndustriesSlider_Widget extends ElementorWidget_Base {
public function get_name() {
return 'industries_slider';
}
public function get_title() {
return __( 'Industries Slider', 'gentium' );
}
public function get_icon() {
return 'eicon-slider-push';
}
public function get_categories() {
return [ 'general' ];
}
protected function _register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'Slides', 'gentium' ),
'tab' => ElementorControls_Manager::TAB_CONTENT,
]
);
$repeater = new ElementorRepeater();
$repeater->add_control(
'slide_image',
[
'label' => __( 'Image', 'gentium' ),
'type' => ElementorControls_Manager::MEDIA,
'default' => [
'url' => ElementorUtils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'button_text',
[
'label' => __( 'Button Text', 'gentium' ),
'type' => ElementorControls_Manager::TEXT,
'default' => __( 'Learn More', 'gentium' ),
]
);
$repeater->add_control(
'button_link',
[
'label' => __( 'Button Link', 'gentium' ),
'type' => ElementorControls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'gentium' ),
'show_external' => true,
]
);
$this->add_control(
'slides',
[
'label' => __( 'Slides', 'gentium' ),
'type' => ElementorControls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [],
'title_field' => '{{{ button_text }}}',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( empty( $settings['slides'] ) ) return;
?>
<!-- Swiper CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<div class="industries-slider-wrapper">
<div class="industries-slider swiper">
<div class="swiper-wrapper">
<?php foreach ( $settings['slides'] as $slide ) : ?>
<div class="swiper-slide">
<img class="industries-slide-image" src="<?php echo esc_url( $slide['slide_image']['url'] ); ?>" alt="" />
<a class="industries-button"
href="<?php echo esc_url( $slide['button_link']['url'] ); ?>"
<?php echo $slide['button_link']['is_external'] ? 'target="_blank"' : ''; ?>>
<span><?php echo esc_html( $slide['button_text'] ); ?></span>
</a>
</div>
<?php endforeach; ?>
</div>
<div class="industries-slider-navigation">
<div class="industries-button-prev custom-arrow">←</div>
<div class="industries-button-next custom-arrow">→</div>
</div>
</div>
</div>
<!-- Swiper JS -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px;
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0 50px 50px 0;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
z-index: 1;
transition: color 0.3s ease;
}
.industries-button::before {
content: '';
position: absolute;
bottom: 0;
left: 16px;
width: 50px;
height: 4px;
background: #f13d68;
border-radius: 0 50px 50px 0;
transition: all 0.4s ease;
z-index: 0;
}
.industries-button:hover::before {
width: calc(100% - 16px);
height: 100%;
border-radius: 0 50px 50px 0;
left: 16px;
}
.industries-button:hover {
color: #fff;
}
.industries-button span {
position: relative;
z-index: 2;
}
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 20px;
}
.custom-arrow {
background: #f13d68;
color: #fff;
font-size: 18px;
font-weight: bold;
border-radius: 50%;
width: 42px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.3s ease;
}
.custom-arrow:hover {
background: #c72e50;
}
</style>
<?php
}
}
—
### ✅ Final Result:
– **Button**:
– Starts with a **16px left inset** pink bar.
– Fills entire button on hover.
– Matches rounded shape and fills smoothly.
– **Arrows**:
– Circular buttons with arrows (`←` / `→`) in center.
– Styled to match pink theme.
Let me know if you want **autoplay**, **arrow icons instead of text**, or a **fade transition** between slides!
—
### ✅ Goal Recap:
– A **16px left gap** at the bottom of the button.
– A **pink bar appears at bottom-left**.
– On hover: it **grows from left to right**, smoothly filling the full button with **curved shape**.
—
### ✅ Fix Implementation:
We'll use a `::after` pseudo-element instead of `::before` and animate **left-to-right scaling** using `transform: scaleX`.
—
### ✅ Final Fixed CSS for Button (Replace Entire Button Style Block)
Replace the existing `.industries-button` CSS with:
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0 50px 50px 0;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
z-index: 1;
transition: color 0.3s ease;
}
/* Fill effect with transform scaling */
.industries-button::after {
content: '';
position: absolute;
bottom: 0;
left: 16px;
height: 100%;
width: calc(100% - 16px);
background: #f13d68;
border-radius: 0 50px 50px 0;
z-index: 0;
transform: scaleX(0.08);
transform-origin: left;
transition: transform 0.4s ease;
}
/* On hover, fully fill from left to right */
.industries-button:hover::after {
transform: scaleX(1);
}
.industries-button:hover {
color: #fff;
}
.industries-button span {
position: relative;
z-index: 2;
}
—
### ✅ Update Button HTML in PHP
Make sure you're wrapping the text in a “ like this (in the `render()` method):
<span><?php echo esc_html( $slide['button_text'] ); ?></span>
—
### ✅ Result:
– Pink starts from the left 16px.
– On hover, the pink expands **smoothly left to right**.
– Fills entire button **without breaking the rounded corner**.
Let me know if you want to apply easing or delay effects to make the fill more dramatic or subtle!
—
### ✅ Features Implemented:
1. **Pink bar starts 16px from the left** bottom corner of the button.
2. On **hover**, it fills the **entire button from left to right** with animation using `transform: scaleX`.
3. The **button text stays on top**, and the pink background has **curved edges**.
4. **Navigation arrows** are styled like circular pink buttons with arrows (`←`, `→`).
—
### ✅ Full Code — `IndustriesSlider_Widget.php`
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class IndustriesSlider_Widget extends ElementorWidget_Base {
public function get_name() {
return 'industries_slider';
}
public function get_title() {
return __( 'Industries Slider', 'gentium' );
}
public function get_icon() {
return 'eicon-slider-push';
}
public function get_categories() {
return [ 'general' ];
}
protected function _register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => __( 'Slides', 'gentium' ),
'tab' => ElementorControls_Manager::TAB_CONTENT,
]
);
$repeater = new ElementorRepeater();
$repeater->add_control(
'slide_image',
[
'label' => __( 'Image', 'gentium' ),
'type' => ElementorControls_Manager::MEDIA,
'default' => [
'url' => ElementorUtils::get_placeholder_image_src(),
],
]
);
$repeater->add_control(
'button_text',
[
'label' => __( 'Button Text', 'gentium' ),
'type' => ElementorControls_Manager::TEXT,
'default' => __( 'Learn More', 'gentium' ),
]
);
$repeater->add_control(
'button_link',
[
'label' => __( 'Button Link', 'gentium' ),
'type' => ElementorControls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'gentium' ),
'show_external' => true,
]
);
$this->add_control(
'slides',
[
'label' => __( 'Slides', 'gentium' ),
'type' => ElementorControls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [],
'title_field' => '{{{ button_text }}}',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( empty( $settings['slides'] ) ) return;
?>
<!-- Swiper CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<div class="industries-slider-wrapper">
<div class="industries-slider swiper">
<div class="swiper-wrapper">
<?php foreach ( $settings['slides'] as $slide ) : ?>
<div class="swiper-slide">
<img class="industries-slide-image" src="<?php echo esc_url( $slide['slide_image']['url'] ); ?>" alt="" />
<a class="industries-button"
href="<?php echo esc_url( $slide['button_link']['url'] ); ?>"
<?php echo $slide['button_link']['is_external'] ? 'target="_blank"' : ''; ?>>
<span><?php echo esc_html( $slide['button_text'] ); ?></span>
</a>
</div>
<?php endforeach; ?>
</div>
<div class="industries-slider-navigation">
<div class="industries-button-prev custom-arrow">←</div>
<div class="industries-button-next custom-arrow">→</div>
</div>
</div>
</div>
<!-- Swiper JS -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.industries-slider', {
slidesPerView: 4,
spaceBetween: 30,
navigation: {
nextEl: '.industries-button-next',
prevEl: '.industries-button-prev',
},
loop: true,
breakpoints: {
0: { slidesPerView: 1 },
600: { slidesPerView: 2 },
992: { slidesPerView: 3 },
1200: { slidesPerView: 4 }
}
});
});
</script>
<style>
.industries-slider-wrapper {
padding: 0;
position: relative;
}
.industries-slider {
padding-bottom: 100px;
}
.industries-slide-image {
width: 100%;
height: auto;
border-radius: 6px;
}
.industries-button {
position: absolute;
bottom: 18px;
left: 0;
background: #fff;
color: #000;
padding: 28px 33px 27px 16px;
border-radius: 0 50px 50px 0;
font-size: 20px;
font-weight: 500;
min-width: 90%;
overflow: hidden;
z-index: 1;
transition: color 0.3s ease;
}
.industries-button::after {
content: '';
position: absolute;
bottom: 0;
left: 16px;
height: 100%;
width: calc(100% - 16px);
background: #f13d68;
border-radius: 0 50px 50px 0;
z-index: 0;
transform: scaleX(0.05);
transform-origin: left;
transition: transform 0.4s ease;
}
.industries-button:hover::after {
transform: scaleX(1);
}
.industries-button:hover {
color: #fff;
}
.industries-button span {
position: relative;
z-index: 2;
}
.industries-slider-navigation {
position: absolute;
bottom: 32px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 20px;
}
.custom-arrow {
background: #f13d68;
color: #fff;
font-size: 18px;
font-weight: bold;
border-radius: 50%;
width: 42px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.3s ease;
}
.custom-arrow:hover {
background: #c72e50;
}
</style>
<?php
}
}
—
### ✅ Final Result:
– Pink bar starts with **16px left inset**.
– Fills the button **from left to right** using `transform: scaleX`.
– Clean hover animation with **curved corners preserved**.
– Navigation arrows are styled as **circular pink buttons**.
Let me know if you want the arrows changed to icons (`SVG` or font-based like `FontAwesome`) or autoplay added.