Alina Ware
16:32
Sliding Buttons JS is a javascript library to create buttons that user can interact by sliding.
You can create a mobile application feeling on your web application.
<linkrel
="stylesheet"href
="https://res.cloudinary.com/dd2ownqt9/raw/upload/v1691930546/sliding-buttons.min.css" />
<script src
="https://res.cloudinary.com/dd2ownqt9/raw/upload/v1691955712/sliding-buttons.min.js"></script>
Import styles inside your head tag.
Import script at the end of body tag.
And you are ready to go! 🚀
<div class="sliding-button-container" id="yourFirstDemo">
<div class="sliding-buttons-on-left">
<div class="sliding-button">
<i class="fa-solid fa-box-archive"></i>
</div>
</div>
<div class="sliding-body">
Slide me horizontally to test!
</div>
<div class="sliding-buttons-on-right">
<div class="sliding-button">
<i class="fa-solid fa-trash-can"></i>
</div>
</div>
</div>
const quickDemo = initSlidingButton("#yourFirstDemo");
Slide to delete notification
Slide to archive or delete message
<div class="sliding-button-container" id="classicDemo">
<div class="sliding-buttons-on-left">
<div class="sliding-button">
<i class="fa-solid fa-box-archive"></i>
</div>
</div>
<div class="sliding-body">
Slide me horizontally to test!
</div>
<div class="sliding-buttons-on-right">
<div class="sliding-button">
<i class="fa-solid fa-trash-can"></i>
</div>
</div>
</div>
// Initialize Javascript
const classicDemo = initSlidingButton("#classicDemo");
<div class="sliding-button-container" id="doubleButtonsDemo">
<div class="sliding-buttons-on-left">
<div class="sliding-button">
<i class="fa-solid fa-box-archive"></i>
</div>
<div class="sliding-button">
Test
</div>
</div>
<div class="sliding-body">
Slide me horizontally to test! (Double buttons)
</div>
<div class="sliding-buttons-on-right">
<div class="sliding-button">
Test
</div>
<div class="sliding-button">
<i class="fa-solid fa-trash-can"></i>
</div>
</div>
</div>
// Initialize Javascript
const doubleButtonsDemo = initSlidingButton("#doubleButtonsDemo");
// Initialize Javascript
const animatedDemo = initSlidingButton("#animatedDemo", {
animation: true
});
// Initialize Javascript
const smallerHeightDemo = initSlidingButton("#smallerHeightDemo", {
style: {
height: 60
}
});
<div class="sliding-button-container" id="oneDirectionDemo">
<div class="sliding-body">
Slide me horizontally to test! (Double buttons)
</div>
<div class="sliding-buttons-on-right">
<div class="sliding-button">
<i class="fa-solid fa-trash-can"></i>
</div>
</div>
</div>
// Initialize Javascript
const oneDirectionDemo = initSlidingButton("#oneDirectionDemo");
Reset sliding button's position and styles.
// Initialize Javascript
const yourSlidingButton = initSlidingButton("#yourSlidingButton", {
animation: true
});
// Reset
yourSlidingButton.reset();