SwipeMe is a jQuery based library can be used to make touch supported slidable element.
- Trigger functions with left or right slide.
- Dynamically change background color opacity with slide distance.
- Accept minimum range of slide to trigger function execution
- Add jQuery and slideMaster to your html page.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/iAmAbhishekJaiswal/slideMaster@main/slideMaster.js"> </script>
- Create object of necessary data related to slide.
var slideData={ rightSlideFunction : function1, leftSlideFunction : function2, rightSlideColor :"#5cb85c", leftSlideColor : "#f0ad4e", range: 0.6 };
-
Now call slideMaster with above object as parameter as following :-
$('.className').slideMaster(slideData);
Here replace className with element's className which you want to make slidable.
Here, rightSlideFunction and leftSlidefunction define function to call with right and left slide respectively.
rightSlideColor and leftSlideColor define background color with right and left slide respectively. It accept only hex color code.
range define the minimum distance to trigger function. It accept value between 0 to 1 . (exp:- 0.7 represent 70% of element width). range is optional and can be omitted. In this case, it used default value 0.6.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.