{"id":8128,"date":"2016-06-27T15:25:00","date_gmt":"2016-06-27T15:25:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/27\/thebird-swipe\/"},"modified":"2022-08-30T15:26:14","modified_gmt":"2022-08-30T15:26:14","slug":"thebird-swipe","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2016\/06\/27\/thebird-swipe\/","title":{"rendered":"thebird\/Swipe"},"content":{"rendered":"<p>Swipe only needs to follow a simple pattern. <code><br \/>\n<\/code><\/p>\n<p>Above is the initial required structure\u2013 a series of elements wrapped in two containers. Place any content you want within the items. The containing div will need to be passed to the Swipe function like so:<\/p>\n<pre><code>window.mySwipe = Swipe(document.getElementById('slider'));\n<\/code><\/pre>\n<p>I always place this at the bottom of the page, externally, to verify the page is ready.<\/p>\n<p>Also Swipe needs just a few styles added to your stylesheet:<\/p>\n<pre><code>.swipe {\n  overflow: hidden;\n  visibility: hidden;\n  position: relative;\n}\n.swipe-wrap {\n  overflow: hidden;\n  position: relative;\n}\n.swipe-wrap &gt; div {\n  float:left;\n  width:100%;\n  position: relative;\n}\n<\/code><\/pre>\n<h2>Config Options<\/h2>\n<p>Swipe can take an optional second parameter\u2013 an object of key\/value settings:<\/p>\n<ul>\n<li><strong>startSlide<\/strong> Integer <em>(default:0)<\/em> &#8211; index position Swipe should start at<\/li>\n<li><strong>speed<\/strong> Integer <em>(default:300)<\/em> &#8211; speed of prev and next transitions in milliseconds.<\/li>\n<li><strong>auto<\/strong> Integer &#8211; begin with auto slideshow (time in milliseconds between slides)<\/li>\n<li><strong>continuous<\/strong> Boolean <em>(default:true)<\/em> &#8211; create an infinite feel with no endpoints<\/li>\n<li><strong>disableScroll<\/strong> Boolean <em>(default:false)<\/em> &#8211; stop any touches on this container from scrolling the page<\/li>\n<li><strong>stopPropagation<\/strong> Boolean <em>(default:false)<\/em> &#8211; stop event propagation<\/li>\n<li><strong>callback<\/strong> Function &#8211; runs at slide change.<\/li>\n<li><strong>transitionEnd<\/strong> Function &#8211; runs at the end slide transition.<\/li>\n<\/ul>\n<h3>Example<\/h3>\n<pre><code>\nwindow.mySwipe = new Swipe(document.getElementById('slider'), {\n  startSlide: 2,\n  speed: 400,\n  auto: 3000,\n  continuous: true,\n  disableScroll: false,\n  stopPropagation: false,\n  callback: function(index, elem) {},\n  transitionEnd: function(index, elem) {}\n});\n\n<\/code><\/pre>\n<h2>Swipe API<\/h2>\n<p>Swipe exposes a few functions that can be useful for script control of your slider.<\/p>\n<p><code>prev()<\/code> slide to prev<\/p>\n<p><code>next()<\/code> slide to next<\/p>\n<p><code>getPos()<\/code> returns current slide index position<\/p>\n<p><code>getNumSlides()<\/code> returns the total amount of slides<\/p>\n<p><code>slide(index, duration)<\/code> slide to set index position (duration: speed of transition in milliseconds)<\/p>\n<h2>Browser Support<\/h2>\n<p>Swipe is now compatible with all browsers, including IE7+. Swipe works best on devices that support CSS transforms and touch, but can be used without these as well. A few helper methods determine touch and CSS transition support and choose the proper animation methods accordingly.<\/p>\n<h2>Who\u2019s using Swipe<\/h2>\n<p><img decoding=\"async\" src=\"http:\/\/swipejs.com\/assets\/swipe-cnn.png\" \/> <img decoding=\"async\" src=\"http:\/\/swipejs.com\/assets\/swipe-airbnb.png\" \/> <img decoding=\"async\" src=\"http:\/\/swipejs.com\/assets\/swipe-nhl.png\" \/> <img decoding=\"async\" src=\"http:\/\/swipejs.com\/assets\/swipe-htc.png\" \/> <img decoding=\"async\" src=\"http:\/\/swipejs.com\/assets\/swipe-thinkgeek.png\" \/> <img decoding=\"async\" src=\"http:\/\/swipejs.com\/assets\/swipe-snapguide.png\" \/><\/p>\n<p>Shoot me a note if you want your logo here<\/p>\n<h2>License<\/h2>\n<p>Copyright \u00a9 2013 Brad Birdsall Licensed under the The MIT License (MIT).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Swipe only needs to follow a simple pattern. Above is the initial required structure\u2013 a series of elements wrapped in two containers. Place any content you want within the items. The containing div will need to be passed to the Swipe function like so: window.mySwipe = Swipe(document.getElementById(&#8216;slider&#8217;)); I always place this at the bottom of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8128","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=8128"}],"version-history":[{"count":2,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8128\/revisions"}],"predecessor-version":[{"id":8736,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8128\/revisions\/8736"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=8128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=8128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=8128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}