😁🤗 Click → Scroll Back to a Specific Element (Anchor Link), click back to element in elementor (ok)
/**
* !Add JS in the footer
*/
add_action('wp_footer', function() { ?>
<script>
document.querySelectorAll('.scroll-back').forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
</script>
<?php
});
/**
* Add JS in the footer!
*/1️⃣ Click → Scroll Back to a Specific Element (Anchor Link)
Steps:
2️⃣ Back to Previous Section (Using Browser History)
Button link:
3️⃣ Back to Top Button (Elementor Native Way)
Option A: Elementor Icon
Option B: Custom ID
4️⃣ Click Back to Element With Offset (Sticky Header Fix)
5️⃣ Advanced: Back to Element with Animation (JS)
🔥 Best Practice Recommendation
👉 Tell me:
PreviousAttribute Starts With Selector [name^="value"] (ok)NextAdding a country code picker to a phone number input field enhances (ok)
Last updated