diff --git a/README.markdown b/README.markdown
index 945a782..c41aca7 100644
--- a/README.markdown
+++ b/README.markdown
@@ -3,20 +3,20 @@
Javascript and jQuery based component for making swipable containers for touch devides and with mouse usage.
# Examples
-
+
Simple mouse/finger swipable textbox: [http://pulges.github.com/Content-Swipe/](http://pulges.github.com/Content-Swipe/)
#Usage
-
+
The css variant with inline-blocks and no predefined width works only with no spaces between boxes in html.
It can be used also with float left boxes but then #swipable must have a width that fits all boxes.
-
+
-
+
...
@@ -28,55 +28,46 @@ It can be used also with float left boxes but then #swipable must have a width t
-
+
#Configuration
-
- $('#swipeable').scroller({
- box_element: '.swipable-box', // classname of box elements
- move_treshold: 0.15, // fraction of width needed to drag to trigger scroll to another page
- tap_treshold: 0.05, // if less than this fraction of width moved, tap event is triggered on scroll box
+
+ new Scroller('swipeable', {
+ box_element: '.swipable-box', // css selector of box elements
+ move_threshold: 0.15, // fraction of width needed to drag to trigger scroll to another page
+ tap_threshold: 0.05, // if less than this fraction of width moved, tap event is triggered on scroll box
fixed_stops: true // if false autoscroll to closest slide is disabled
});
#Events
If movement of less than tap treshold occurs. "tap" event is triggered on ".swipable-box"
-
- $('.swipable-box').on('tap', function() { alert('tap'); });
-
+
+ document.querySelector('.swipable-box').addEventListener('tap', function() { alert('tap'); });
+
After scroll animation finishes "scrollstop" event is triggered on "#swipeable" with index of scroll page position as second parameter
- $('#swipeable').on("scrollstop", function(event, index) {
- alert("Scrolled to index: " + index);
+ document.getElementById('swipeable').addEventListener('scrollstop', function(event) {
+ alert('Scrolled to index: ' + event.detail.currentIndex);
});
-
+
#Actions
Example of accessing inner functions
- $('#swipeable').scroller();
-
+ var scroller = new Scroller(document.getElementById('swipeable'));
+
// to next slide
- $('#next').click(function() {
- $('#swipeable').scroller().next();
- });
-
+ scroller.next();
+
// to prev slide
- $('#prev').click(function() {
- $('#swipeable').scroller().previous();
- });
+ scroller.previous();
// slide to third slide (index 2 as list is 0 based)
- $('#to3').click(function() {
- $('#swipeable').scroller().move_to(2);
- });
+ scroller.move_to(2);
// switch to third slide without animation
- $('#to3_i').click(function() {
- $('#swipeable').scroller().move_to(2, true);
- });
-
+ scroller.move_to(2, true);
+
NB! Will update the gallery example soon. Current one will not work with new library.
-
\ No newline at end of file
diff --git a/example.html b/example.html
index 2d28b06..6aee2a3 100644
--- a/example.html
+++ b/example.html
@@ -46,32 +46,31 @@