From 2033c35059b4e25bbcb6f63ba80c655a55c09202 Mon Sep 17 00:00:00 2001 From: Adam Smith Date: Thu, 7 May 2015 11:25:57 +0200 Subject: [PATCH] 0.10.3 Minor release - 0.10.3 --- .gitignore | 6 + README.md | 8 +- bower.json | 2 +- dev/slidebars.css | 8 + dev/slidebars.js | 8 + development/readme.txt | 1 - {development => dist}/slidebars.css | 2 +- {development => dist}/slidebars.js | 18 +- dist/slidebars.min.css | 2 + dist/slidebars.min.js | 2 + distribution/0.10.1/slidebars.css | 213 --------------- distribution/0.10.1/slidebars.js | 346 ------------------------- distribution/0.10.1/slidebars.min.css | 2 - distribution/0.10.1/slidebars.min.js | 2 - distribution/0.10.2/slidebars.css | 208 --------------- distribution/0.10.2/slidebars.js | 346 ------------------------- distribution/0.10.2/slidebars.min.css | 2 - distribution/0.10.2/slidebars.min.js | 2 - distribution/0.10/slidebars.css | 207 --------------- distribution/0.10/slidebars.js | 349 ------------------------- distribution/0.10/slidebars.min.css | 2 - distribution/0.10/slidebars.min.js | 2 - distribution/0.7.1/slidebars.css | 130 ---------- distribution/0.7.1/slidebars.js | 271 ------------------- distribution/0.7.1/slidebars.min.css | 2 - distribution/0.7.1/slidebars.min.js | 2 - distribution/0.7/slidebars.css | 121 --------- distribution/0.7/slidebars.js | 358 -------------------------- distribution/0.7/slidebars.min.css | 2 - distribution/0.7/slidebars.min.js | 2 - distribution/0.8.1/slidebars.css | 139 ---------- distribution/0.8.1/slidebars.js | 284 -------------------- distribution/0.8.1/slidebars.min.css | 2 - distribution/0.8.1/slidebars.min.js | 2 - distribution/0.8.2/slidebars.css | 141 ---------- distribution/0.8.2/slidebars.js | 294 --------------------- distribution/0.8.2/slidebars.min.css | 2 - distribution/0.8.2/slidebars.min.js | 2 - distribution/0.8/slidebars.css | 139 ---------- distribution/0.8/slidebars.js | 284 -------------------- distribution/0.8/slidebars.min.css | 2 - distribution/0.8/slidebars.min.js | 2 - distribution/0.9.4/slidebars.css | 195 -------------- distribution/0.9.4/slidebars.js | 328 ----------------------- distribution/0.9.4/slidebars.min.css | 2 - distribution/0.9.4/slidebars.min.js | 2 - distribution/0.9/slidebars.css | 196 -------------- distribution/0.9/slidebars.js | 328 ----------------------- distribution/0.9/slidebars.min.css | 2 - distribution/0.9/slidebars.min.js | 2 - examples/slidebars/slidebars.css | 33 ++- examples/slidebars/slidebars.js | 318 ++++++++++++----------- license.txt | 2 +- slidebars.jquery.json | 2 +- 54 files changed, 231 insertions(+), 5098 deletions(-) create mode 100644 .gitignore create mode 100644 dev/slidebars.css create mode 100644 dev/slidebars.js delete mode 100644 development/readme.txt rename {development => dist}/slidebars.css (97%) rename {development => dist}/slidebars.js (97%) create mode 100644 dist/slidebars.min.css create mode 100644 dist/slidebars.min.js delete mode 100644 distribution/0.10.1/slidebars.css delete mode 100644 distribution/0.10.1/slidebars.js delete mode 100644 distribution/0.10.1/slidebars.min.css delete mode 100644 distribution/0.10.1/slidebars.min.js delete mode 100644 distribution/0.10.2/slidebars.css delete mode 100644 distribution/0.10.2/slidebars.js delete mode 100644 distribution/0.10.2/slidebars.min.css delete mode 100644 distribution/0.10.2/slidebars.min.js delete mode 100644 distribution/0.10/slidebars.css delete mode 100644 distribution/0.10/slidebars.js delete mode 100644 distribution/0.10/slidebars.min.css delete mode 100644 distribution/0.10/slidebars.min.js delete mode 100644 distribution/0.7.1/slidebars.css delete mode 100644 distribution/0.7.1/slidebars.js delete mode 100644 distribution/0.7.1/slidebars.min.css delete mode 100644 distribution/0.7.1/slidebars.min.js delete mode 100644 distribution/0.7/slidebars.css delete mode 100644 distribution/0.7/slidebars.js delete mode 100644 distribution/0.7/slidebars.min.css delete mode 100644 distribution/0.7/slidebars.min.js delete mode 100644 distribution/0.8.1/slidebars.css delete mode 100644 distribution/0.8.1/slidebars.js delete mode 100644 distribution/0.8.1/slidebars.min.css delete mode 100644 distribution/0.8.1/slidebars.min.js delete mode 100644 distribution/0.8.2/slidebars.css delete mode 100644 distribution/0.8.2/slidebars.js delete mode 100644 distribution/0.8.2/slidebars.min.css delete mode 100644 distribution/0.8.2/slidebars.min.js delete mode 100644 distribution/0.8/slidebars.css delete mode 100644 distribution/0.8/slidebars.js delete mode 100644 distribution/0.8/slidebars.min.css delete mode 100644 distribution/0.8/slidebars.min.js delete mode 100644 distribution/0.9.4/slidebars.css delete mode 100644 distribution/0.9.4/slidebars.js delete mode 100644 distribution/0.9.4/slidebars.min.css delete mode 100644 distribution/0.9.4/slidebars.min.js delete mode 100644 distribution/0.9/slidebars.css delete mode 100644 distribution/0.9/slidebars.js delete mode 100644 distribution/0.9/slidebars.min.css delete mode 100644 distribution/0.9/slidebars.min.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bb17bd0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +site +docs +images + +Slidebars.esproj +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index eaaaa85..dfb717e 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,7 @@ Slidebars is a jQuery framework for quickly and easily implementing app style of See the [Slidebars website](http://plugins.adchsm.me/slidebars/) for information on getting started, usage documentation and compatibility tables. -Slidebars is stable, but still in early development. It's markup, installation and functionality is likely to change at any time, therefore I advise you to read up on any usage changes when updating to ensure it goes smoothly. - -## Development on Hold - -Fortunately, life is good and work is busy, I currently have no time to spend developing Slidebars. This doesn't mean its finished or abandoned, its just temporarily on hold, until winter, or when work calms down. - -I also need to spend some time refining my skills and learning more pure JS, I want Slidebars to run independently and not rely on other libraries such as jQuery. 0.11 and 0.12 will expand and improve the current jQuery version, but after that it's likely to change. +Version 0.10.3 is the last release of Slidebars in its current format. Development on an entirely new version will be starting soon. ## Extentions diff --git a/bower.json b/bower.json index fffe105..2ac1c3f 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "Slidebars", - "version": "0.10.2", + "version": "0.10.3", "dependencies": { "jquery": ">=1.8" } diff --git a/dev/slidebars.css b/dev/slidebars.css new file mode 100644 index 0000000..5ae85f5 --- /dev/null +++ b/dev/slidebars.css @@ -0,0 +1,8 @@ +/*! + * Slidebars + * Description: A jQuery framework for off-canvas menus and sidebars. + * Version: Development + * URL: http://plugins.adchsm.me/slidebars/ + * Author: Adam Smith - http://www.adchsm.me/ + * License: MIT - http://opensource.org/licenses/MIT + */ \ No newline at end of file diff --git a/dev/slidebars.js b/dev/slidebars.js new file mode 100644 index 0000000..5ae85f5 --- /dev/null +++ b/dev/slidebars.js @@ -0,0 +1,8 @@ +/*! + * Slidebars + * Description: A jQuery framework for off-canvas menus and sidebars. + * Version: Development + * URL: http://plugins.adchsm.me/slidebars/ + * Author: Adam Smith - http://www.adchsm.me/ + * License: MIT - http://opensource.org/licenses/MIT + */ \ No newline at end of file diff --git a/development/readme.txt b/development/readme.txt deleted file mode 100644 index bbf38d6..0000000 --- a/development/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Don't use the development version in your production site. Instead, use the latest version in the distribution directory. \ No newline at end of file diff --git a/development/slidebars.css b/dist/slidebars.css similarity index 97% rename from development/slidebars.css rename to dist/slidebars.css index 66646c8..8e511bd 100644 --- a/development/slidebars.css +++ b/dist/slidebars.css @@ -1,6 +1,6 @@ /* ----------------------------------- * Slidebars - * Development version 0.10.3, do not use this in a production site, use the latest in the distribution folder. + * Version 0.10.3 * http://plugins.adchsm.me/slidebars/ * * Written by Adam Smith diff --git a/development/slidebars.js b/dist/slidebars.js similarity index 97% rename from development/slidebars.js rename to dist/slidebars.js index d88b0d3..4b22dcf 100644 --- a/development/slidebars.js +++ b/dist/slidebars.js @@ -1,6 +1,6 @@ // ----------------------------------- // Slidebars -// Development version 0.10.3, do not use this in a production site, use the latest in the distribution folder. +// Version 0.10.3 // http://plugins.adchsm.me/slidebars/ // // Written by Adam Smith @@ -165,14 +165,14 @@ // Apply animation if ( animation === 'translate' ) { if ( amount === '0px' ) { - removeStyleAttributes(); + removeAnimation(); } else { selector.css( 'transform', 'translate( ' + amount + ' )' ); // Apply the animation. } - + } else if ( animation === 'side' ) { if ( amount === '0px' ) { - removeStyleAttributes(); + removeAnimation(); } else { if ( amount[0] === '-' ) amount = amount.substr( 1 ); // Remove the '-' from the passed amount for side animations. selector.css( side, '0px' ); // Add a 0 value so css transition works. @@ -180,20 +180,16 @@ selector.css( side, amount ); // Apply the animation. }, 1 ); } - + } else if ( animation === 'jQuery' ) { if ( amount[0] === '-' ) amount = amount.substr( 1 ); // Remove the '-' from the passed amount for jQuery animations. var properties = {}; properties[side] = amount; selector.stop().animate( properties, 400 ); // Stop any current jQuery animation before starting another. - - if ( amount === '0px' ) { - setTimeout( removeStyleAttributes, 400 ); - } } - function removeStyleAttributes() { - // Remove animation + // Remove animation + function removeAnimation () { selector.removeAttr( 'style' ); css(); } diff --git a/dist/slidebars.min.css b/dist/slidebars.min.css new file mode 100644 index 0000000..7928fc6 --- /dev/null +++ b/dist/slidebars.min.css @@ -0,0 +1,2 @@ +/* Slidebars 0.10.3 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt) */ +#sb-site,.sb-site-container,.sb-slidebar,body,html{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body,html{width:100%;overflow-x:hidden}html{height:100%}body{min-height:100%;height:auto;position:relative}html.sb-scroll-lock.sb-active:not(.sb-static){overflow:hidden}#sb-site,.sb-site-container{width:100%;min-height:100vh;position:relative;z-index:1;background-color:#fff}#sb-site:after,#sb-site:before,.sb-site-container:after,.sb-site-container:before{content:' ';display:table;clear:both}.sb-slidebar{height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;display:none;background-color:#222}.sb-slidebar,.sb-slidebar *{-webkit-transform:translateZ(0px)}.sb-left{left:0}.sb-right{right:0}.sb-slidebar.sb-static,html.sb-static .sb-slidebar{position:absolute}.sb-slidebar.sb-active{display:block}.sb-style-overlay{z-index:9999}.sb-momentum-scrolling{-webkit-overflow-scrolling:touch}.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}@media (max-width:480px){.sb-slidebar{width:70%}.sb-width-thin{width:55%}.sb-width-wide{width:85%}}@media (min-width:481px){.sb-slidebar{width:55%}.sb-width-thin{width:40%}.sb-width-wide{width:70%}}@media (min-width:768px){.sb-slidebar{width:40%}.sb-width-thin{width:25%}.sb-width-wide{width:55%}}@media (min-width:992px){.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}}@media (min-width:1200px){.sb-slidebar{width:20%}.sb-width-thin{width:5%}.sb-width-wide{width:35%}}#sb-site,.sb-site-container,.sb-slide,.sb-slidebar{-webkit-transform:translate(0px);-moz-transform:translate(0px);-o-transform:translate(0px);transform:translate(0px);-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left,right;-webkit-backface-visibility:hidden}.sb-hide{display:none} \ No newline at end of file diff --git a/dist/slidebars.min.js b/dist/slidebars.min.js new file mode 100644 index 0000000..36e43f9 --- /dev/null +++ b/dist/slidebars.min.js @@ -0,0 +1,2 @@ +// Slidebars 0.10.3 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt) +!function(t){t.slidebars=function(s){function e(){!c.disableOver||"number"==typeof c.disableOver&&c.disableOver>=k?(w=!0,t("html").addClass("sb-init"),c.hideControlClasses&&T.removeClass("sb-hide"),i()):"number"==typeof c.disableOver&&c.disableOvers&&g.css("minHeight",t("html").css("height")),m&&m.hasClass("sb-width-custom")&&m.css("width",m.attr("data-sb-width")),C&&C.hasClass("sb-width-custom")&&C.css("width",C.attr("data-sb-width")),m&&(m.hasClass("sb-style-push")||m.hasClass("sb-style-overlay"))&&m.css("marginLeft","-"+m.css("width")),C&&(C.hasClass("sb-style-push")||C.hasClass("sb-style-overlay"))&&C.css("marginRight","-"+C.css("width")),c.scrollLock&&t("html").addClass("sb-scroll-lock")}function n(t,s,e){function n(){a.removeAttr("style"),i()}var a;if(a=t.hasClass("sb-style-push")?g.add(t).add(O):t.hasClass("sb-style-overlay")?t:g.add(O),"translate"===x)"0px"===s?n():a.css("transform","translate( "+s+" )");else if("side"===x)"0px"===s?n():("-"===s[0]&&(s=s.substr(1)),a.css(e,"0px"),setTimeout(function(){a.css(e,s)},1));else if("jQuery"===x){"-"===s[0]&&(s=s.substr(1));var o={};o[e]=s,a.stop().animate(o,400)}}function a(s){function e(){w&&"left"===s&&m?(t("html").addClass("sb-active sb-active-left"),m.addClass("sb-active"),n(m,m.css("width"),"left"),setTimeout(function(){p=!0},400)):w&&"right"===s&&C&&(t("html").addClass("sb-active sb-active-right"),C.addClass("sb-active"),n(C,"-"+C.css("width"),"right"),setTimeout(function(){y=!0},400))}"left"===s&&m&&y||"right"===s&&C&&p?(o(),setTimeout(e,400)):e()}function o(s,e){(p||y)&&(p&&(n(m,"0px","left"),p=!1),y&&(n(C,"0px","right"),y=!1),setTimeout(function(){t("html").removeClass("sb-active sb-active-left sb-active-right"),m&&m.removeClass("sb-active"),C&&C.removeClass("sb-active"),"undefined"!=typeof s&&(void 0===typeof e&&(e="_self"),window.open(s,e))},400))}function l(t){"left"===t&&m&&(p?o():a("left")),"right"===t&&C&&(y?o():a("right"))}function r(t,s){t.stopPropagation(),t.preventDefault(),"touchend"===t.type&&s.off("click")}var c=t.extend({siteClose:!0,scrollLock:!1,disableOver:!1,hideControlClasses:!1},s),h=document.createElement("div").style,d=!1,f=!1;(""===h.MozTransition||""===h.WebkitTransition||""===h.OTransition||""===h.transition)&&(d=!0),(""===h.MozTransform||""===h.WebkitTransform||""===h.OTransform||""===h.transform)&&(f=!0);var u=navigator.userAgent,b=!1,v=!1;/Android/.test(u)?b=u.substr(u.indexOf("Android")+8,3):/(iPhone|iPod|iPad)/.test(u)&&(v=u.substr(u.indexOf("OS ")+3,3).replace("_",".")),(b&&3>b||v&&5>v)&&t("html").addClass("sb-static");var g=t("#sb-site, .sb-site-container");if(t(".sb-left").length)var m=t(".sb-left"),p=!1;if(t(".sb-right").length)var C=t(".sb-right"),y=!1;var w=!1,k=t(window).width(),T=t(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"),O=t(".sb-slide");e(),t(window).resize(function(){var s=t(window).width();k!==s&&(k=s,e(),p&&a("left"),y&&a("right"))});var x;d&&f?(x="translate",b&&4.4>b&&(x="side")):x="jQuery",this.slidebars={open:a,close:o,toggle:l,init:function(){return w},active:function(t){return"left"===t&&m?p:"right"===t&&C?y:void 0},destroy:function(t){"left"===t&&m&&(p&&o(),setTimeout(function(){m.remove(),m=!1},400)),"right"===t&&C&&(y&&o(),setTimeout(function(){C.remove(),C=!1},400))}},t(".sb-toggle-left").on("touchend click",function(s){r(s,t(this)),l("left")}),t(".sb-toggle-right").on("touchend click",function(s){r(s,t(this)),l("right")}),t(".sb-open-left").on("touchend click",function(s){r(s,t(this)),a("left")}),t(".sb-open-right").on("touchend click",function(s){r(s,t(this)),a("right")}),t(".sb-close").on("touchend click",function(s){if(t(this).is("a")||t(this).children().is("a")){if("click"===s.type){s.stopPropagation(),s.preventDefault();var e=t(this).is("a")?t(this):t(this).find("a"),i=e.attr("href"),n=e.attr("target")?e.attr("target"):"_self";o(i,n)}}else r(s,t(this)),o()}),g.on("touchend click",function(s){c.siteClose&&(p||y)&&(r(s,t(this)),o())})}}(jQuery); \ No newline at end of file diff --git a/distribution/0.10.1/slidebars.css b/distribution/0.10.1/slidebars.css deleted file mode 100644 index 4bed2ae..0000000 --- a/distribution/0.10.1/slidebars.css +++ /dev/null @@ -1,213 +0,0 @@ -/* ----------------------------------- - * Slidebars - * Version 0.10.1 - * http://plugins.adchsm.me/slidebars/ - * - * Written by Adam Smith - * http://www.adchsm.me/ - * - * Released under MIT License - * http://plugins.adchsm.me/slidebars/license.txt - * - * ------------------- - * Slidebars CSS Index - * - * 001 - Box Model, Html & Body - * 002 - Site - * 003 - Slidebars - * 004 - Animation - * 005 - Helper Classes - * - * ---------------------------- - * 001 - Box Model, Html & Body - */ - -html, body, #sb-site, .sb-site-container, .sb-slidebar { - /* Set box model to prevent any user added margins or paddings from altering the widths or heights. */ - margin: 0; - padding: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -html, body { - width: 100%; - overflow-x: hidden; /* Stops horizontal scrolling. */ -} - -html { - height: 100%; /* Site is as tall as device. */ -} - -body { - min-height: 100%; - height: auto; - position: relative; /* Required for static Slidebars to function properly. */ -} - -/* Site scroll locking - prevent site from scrolling when a Slidebar is open, except when static Slidebars are only available. */ -html.sb-scroll-lock body { - height: 100%; -} - -html.sb-scroll-lock.sb-active:not(.sb-static), -html.sb-scroll-lock.sb-active:not(.sb-static) body { - overflow: hidden; -} - -/* ---------- - * 002 - Site - */ - -#sb-site, .sb-site-container { - /* You may now use class .sb-site-container instead of #sb-site and use your own id. However please make sure you don't set any of the following styles any differently on your id. */ - width: 100%; - position: relative; - z-index: 1; /* Site sits above Slidebars */ - background-color: #ffffff; /* Default background colour, overwrite this with your own css. I suggest moving your html or body background styling here. Making this transparent will allow the Slidebars beneath to be visible. */ -} - -/* --------------- - * 003 - Slidebars - */ - -.sb-slidebar { - height: 100%; - overflow-y: auto; /* Enable vertical scrolling on Slidebars when needed. */ - position: fixed; - top: 0; - z-index: 0; /* Slidebars sit behind sb-site. */ - display: none; /* Initially hide the Slidebars. Changed from visibility to display to allow -webkit-overflow-scrolling. */ - background-color: #222222; /* Default Slidebars background colour, overwrite this with your own css. */ - -webkit-transform: translate(0px); /* Fixes issues with translated and z-indexed elements on iOS 7. */ -} - -.sb-left { - left: 0; /* Set Slidebar to the left. */ -} - -.sb-right { - right: 0; /* Set Slidebar to the right. */ -} - -html.sb-static .sb-slidebar, -.sb-slidebar.sb-static { - position: absolute; /* Makes Slidebars scroll naturally with the site, and unfixes them for Android Browser < 3 and iOS < 5. */ -} - -.sb-slidebar.sb-active { - display: block; /* Makes Slidebars visibile when open. Changed from visibility to display to allow -webkit-overflow-scrolling. */ -} - -.sb-style-overlay { - z-index: 9999; /* Set z-index high to ensure it overlays any other site elements. */ -} - -.sb-momentum-scrolling { - -webkit-overflow-scrolling: touch; /* Adds native momentum scrolling for iOS & Android devices. */ -} - -/* Slidebar widths for browsers/devices that don't support media queries. */ - .sb-slidebar { - width: 30%; - } - - .sb-width-thin { - width: 15%; - } - - .sb-width-wide { - width: 45%; - } - -@media (max-width: 480px) { /* Slidebar widths on extra small screens. */ - .sb-slidebar { - width: 70%; - } - - .sb-width-thin { - width: 55%; - } - - .sb-width-wide { - width: 85%; - } -} - -@media (min-width: 481px) { /* Slidebar widths on small screens. */ - .sb-slidebar { - width: 55%; - } - - .sb-width-thin { - width: 40%; - } - - .sb-width-wide { - width: 70%; - } -} - -@media (min-width: 768px) { /* Slidebar widths on medium screens. */ - .sb-slidebar { - width: 40%; - } - - .sb-width-thin { - width: 25%; - } - - .sb-width-wide { - width: 55%; - } -} - -@media (min-width: 992px) { /* Slidebar widths on large screens. */ - .sb-slidebar { - width: 30%; - } - - .sb-width-thin { - width: 15%; - } - - .sb-width-wide { - width: 45%; - } -} - -@media (min-width: 1200px) { /* Slidebar widths on extra large screens. */ - .sb-slidebar { - width: 20%; - } - - .sb-width-thin { - width: 5%; - } - - .sb-width-wide { - width: 35%; - } -} - -/* --------------- - * 004 - Animation - */ - -.sb-slide, #sb-site, .sb-site-container, .sb-slidebar { - -webkit-transition: -webkit-transform 400ms ease; - -moz-transition: -moz-transform 400ms ease; - -o-transition: -o-transform 400ms ease; - transition: transform 400ms ease; - -webkit-transition-property: -webkit-transform, left, right; /* Add left/right for Android < 4.4. */ - -webkit-backface-visibility: hidden; /* Prevents flickering. This is non essential, and you may remove it if your having problems with fixed background images in Chrome. */ -} - -/* -------------------- - * 005 - Helper Classes - */ - -.sb-hide { - display: none; /* Optionally applied to control classes when Slidebars is disabled over a certain width. */ -} \ No newline at end of file diff --git a/distribution/0.10.1/slidebars.js b/distribution/0.10.1/slidebars.js deleted file mode 100644 index 8f1f42e..0000000 --- a/distribution/0.10.1/slidebars.js +++ /dev/null @@ -1,346 +0,0 @@ -// ----------------------------------- -// Slidebars -// Version 0.10.1 -// http://plugins.adchsm.me/slidebars/ -// -// Written by Adam Smith -// http://www.adchsm.me/ -// -// Released under MIT License -// http://plugins.adchsm.me/slidebars/license.txt -// -// --------------------- -// Index of Slidebars.js -// -// 001 - Default Settings -// 002 - Feature Detection -// 003 - User Agents -// 004 - Setup -// 005 - Animation -// 006 - Operations -// 007 - API -// 008 - User Input - -;(function($) { - - $.slidebars = function(options) { - - // ---------------------- - // 001 - Default Settings - - var settings = $.extend({ - siteClose: true, // true or false - Enable closing of Slidebars by clicking on #sb-site. - scrollLock: false, // true or false - Prevent scrolling of site when a Slidebar is open. - disableOver: false, // integer or false - Hide Slidebars over a specific width. - hideControlClasses: false // true or false - Hide controls at same width as disableOver. - }, options); - - // ----------------------- - // 002 - Feature Detection - - var test = document.createElement('div').style, // Create element to test on. - supportTransition = false, // Variable for testing transitions. - supportTransform = false; // variable for testing transforms. - - // Test for CSS Transitions - if (test.MozTransition === '' || test.WebkitTransition === '' || test.OTransition === '' || test.transition === '') supportTransition = true; - - // Test for CSS Transforms - if (test.MozTransform === '' || test.WebkitTransform === '' || test.OTransform === '' || test.transform === '') supportTransform = true; - - // ----------------- - // 003 - User Agents - - var ua = navigator.userAgent, // Get user agent string. - android = false, // Variable for storing android version. - iOS = false; // Variable for storing iOS version. - - if (/Android/.test(ua)) { // Detect Android in user agent string. - android = ua.substr(ua.indexOf('Android')+8, 3); // Set version of Android. - } else if (/(iPhone|iPod|iPad)/.test(ua)) { // Detect iOS in user agent string. - iOS = ua.substr(ua.indexOf('OS ')+3, 3).replace('_', '.'); // Set version of iOS. - } - - if (android && android < 3 || iOS && iOS < 5) $('html').addClass('sb-static'); // Add helper class for older versions of Android & iOS. - - // ----------- - // 004 - Setup - - // Site container - var $site = $('#sb-site, .sb-site-container'); // Cache the selector. - - // Left Slidebar - if ($('.sb-left').length) { // Check if the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check if the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - } - - var init = false, // Initialisation variable. - windowWidth = $(window).width(), // Get width of window. - $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'), // Cache the control classes. - $slide = $('.sb-slide'); // Cache users elements to animate. - - // Initailise Slidebars - function initialise() { - if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. - init = true; // true enabled Slidebars to open. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.removeClass('sb-hide'); // Remove class just incase Slidebars was originally disabled. - css(); // Set required inline styles. - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. - init = false; // false stop Slidebars from opening. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.addClass('sb-hide'); // Hide controls - $site.css('minHeight', ''); // Remove minimum height. - if (leftActive || rightActive) close(); // Close Slidebars if open. - } - } - initialise(); - - // Inline CSS - function css() { - // Set minimum height. - $site.css('minHeight', ''); // Reset minimum height. - $site.css('minHeight', $('html').height() + 'px'); // Set minimum height of the site to the minimum height of the html. - - // Custom Slidebar widths. - if ($left && $left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - if ($right && $right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. - - // Set off-canvas margins for Slidebars with push and overlay animations. - if ($left && ($left.hasClass('sb-style-push') || $left.hasClass('sb-style-overlay'))) $left.css('marginLeft', '-' + $left.css('width')); - if ($right && ($right.hasClass('sb-style-push') || $right.hasClass('sb-style-overlay'))) $right.css('marginRight', '-' + $right.css('width')); - - // Site scroll locking. - if (settings.scrollLock) $('html').addClass('sb-scroll-lock'); - } - - // Resize Functions - $(window).resize(function() { - var resizedWindowWidth = $(window).width(); // Get resized window width. - if (windowWidth !== resizedWindowWidth) { // Slidebars is running and window was actually resized. - windowWidth = resizedWindowWidth; // Set the new window width. - initialise(); // Call initalise to see if Slidebars should still be running. - if (leftActive) open('left'); // If left Slidebar is open, calling open will ensure it is the correct size. - if (rightActive) open('right'); // If right Slidebar is open, calling open will ensure it is the correct size. - } - }); - // I may include a height check along side a width check here in future. - - // --------------- - // 005 - Animation - - var animation; // Animation type. - - // Set animation type. - if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. - animation = 'translate'; // Translate for browsers that support it. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - - // Animate mixin. - function animate(object, amount, side) { - // Choose selectors depending on animation style. - var selector; - - if (object.hasClass('sb-style-push')) { - selector = $site.add(object).add($slide); // Push - Animate site, Slidebar and user elements. - } else if (object.hasClass('sb-style-overlay')) { - selector = object; // Overlay - Animate Slidebar only. - } else { - selector = $site.add($slide); // Reveal - Animate site and user elements. - } - - // Apply animation - if (animation === 'translate') { - selector.css('transform', 'translate(' + amount + ')'); // Apply the animation. - - } else if (animation === 'side') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for side animations. - if (amount !== '0px') selector.css(side, '0px'); // Add a 0 value so css transition works. - setTimeout(function() { // Set a timeout to allow the 0 value to be applied above. - selector.css(side, amount); // Apply the animation. - }, 1); - - } else if (animation === 'jQuery') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for jQuery animations. - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); // Stop any current jQuery animation before starting another. - } - - // If closed, remove the inline styling on completion of the animation. - setTimeout(function() { - if (amount === '0px') { - selector.removeAttr('style'); - css(); - } - }, 400); - } - - // ---------------- - // 006 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - $left.addClass('sb-active'); - animate($left, $left.css('width'), 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - $right.addClass('sb-active'); - animate($right, '-' + $right.css('width'), 'right'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. - } - } - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - if (leftActive) { - animate($left, '0px', 'left'); // Animation - leftActive = false; - } - if (rightActive) { - animate($right, '0px', 'right'); // Animation - rightActive = false; - } - - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if ($left) $left.removeClass('sb-active'); - if ($right) $right.removeClass('sb-active'); - if (typeof link !== 'undefined') window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - } - - // --------- - // 007 - API - - this.slidebars = { - open: open, // Maps user variable name to the open method. - close: close, // Maps user variable name to the close method. - toggle: toggle, // Maps user variable name to the toggle method. - init: function() { // Returns true or false whether Slidebars are running or not. - return init; // Returns true or false whether Slidebars are running. - }, - active: function(side) { // Returns true or false whether Slidebar is open or closed. - if (side === 'left' && $left) return leftActive; - if (side === 'right' && $right) return rightActive; - }, - destroy: function(side) { // Removes the Slidebar from the DOM. - if (side === 'left' && $left) { - if (leftActive) close(); // Close if its open. - setTimeout(function() { - $left.remove(); // Remove it. - $left = false; // Set variable to false so it cannot be opened again. - }, 400); - } - if (side === 'right' && $right) { - if (rightActive) close(); // Close if its open. - setTimeout(function() { - $right.remove(); // Remove it. - $right = false; // Set variable to false so it cannot be opened again. - }, 400); - } - } - }; - - // ---------------- - // 008 - User Input - - function eventHandler(event, selector) { - event.stopPropagation(); // Stop event bubbling. - event.preventDefault(); // Prevent default behaviour. - if (event.type === 'touchend') selector.off('click'); // If event type was touch, turn off clicks to prevent phantom clicks. - } - - // Toggle left Slidebar - $('.sb-toggle-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('left'); // Toggle the left Slidbar. - }); - - // Toggle right Slidebar - $('.sb-toggle-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('right'); // Toggle the right Slidbar. - }); - - // Open left Slidebar - $('.sb-open-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('left'); // Open the left Slidebar. - }); - - // Open right Slidebar - $('.sb-open-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('right'); // Open the right Slidebar. - }); - - // Close Slidebar - $('.sb-close').on('touchend click', function(event) { - if ( $(this).is('a') || $(this).children().is('a') ) { // Is a link or contains a link. - if ( event.type === 'click' ) { // Make sure the user wanted to follow the link. - event.preventDefault(); // Stop default behaviour. - var href = ( $(this).is('a') ? $(this).attr('href') : $(this).find('a').attr('href') ); // Get the href. - close( href ); // Close Slidebar and pass link. - } - } else { // Just a normal control class. - eventHandler(event, $(this)); // Handle the event. - close(); // Close Slidebar. - } - }); - - // Close Slidebar via site - $site.on('touchend click', function(event) { - if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. - eventHandler(event, $(this)); // Handle the event. - close(); // Close it. - } - }); - - }; // End Slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.10.1/slidebars.min.css b/distribution/0.10.1/slidebars.min.css deleted file mode 100644 index b129ab4..0000000 --- a/distribution/0.10.1/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.10.1 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt) */ -#sb-site,.sb-site-container,.sb-slidebar,body,html{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body,html{width:100%;overflow-x:hidden}html{height:100%}body{min-height:100%;height:auto;position:relative}html.sb-scroll-lock body{height:100%}html.sb-scroll-lock.sb-active:not(.sb-static),html.sb-scroll-lock.sb-active:not(.sb-static) body{overflow:hidden}#sb-site,.sb-site-container{width:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;display:none;background-color:#222;-webkit-transform:translate(0px)}.sb-left{left:0}.sb-right{right:0}.sb-slidebar.sb-static,html.sb-static .sb-slidebar{position:absolute}.sb-slidebar.sb-active{display:block}.sb-style-overlay{z-index:9999}.sb-momentum-scrolling{-webkit-overflow-scrolling:touch}.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}@media (max-width:480px){.sb-slidebar{width:70%}.sb-width-thin{width:55%}.sb-width-wide{width:85%}}@media (min-width:481px){.sb-slidebar{width:55%}.sb-width-thin{width:40%}.sb-width-wide{width:70%}}@media (min-width:768px){.sb-slidebar{width:40%}.sb-width-thin{width:25%}.sb-width-wide{width:55%}}@media (min-width:992px){.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}}@media (min-width:1200px){.sb-slidebar{width:20%}.sb-width-thin{width:5%}.sb-width-wide{width:35%}}#sb-site,.sb-site-container,.sb-slide,.sb-slidebar{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left,right;-webkit-backface-visibility:hidden}.sb-hide{display:none} \ No newline at end of file diff --git a/distribution/0.10.1/slidebars.min.js b/distribution/0.10.1/slidebars.min.js deleted file mode 100644 index 24c0074..0000000 --- a/distribution/0.10.1/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.10.1 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt) -!function(t){t.slidebars=function(s){function e(){!c.disableOver||"number"==typeof c.disableOver&&c.disableOver>=T?(y=!0,t("html").addClass("sb-init"),c.hideControlClasses&&k.removeClass("sb-hide"),i()):"number"==typeof c.disableOver&&c.disableOverb||v&&5>v)&&t("html").addClass("sb-static");var g=t("#sb-site, .sb-site-container");if(t(".sb-left").length)var m=t(".sb-left"),C=!1;if(t(".sb-right").length)var p=t(".sb-right"),w=!1;var y=!1,T=t(window).width(),k=t(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"),O=t(".sb-slide");e(),t(window).resize(function(){var s=t(window).width();T!==s&&(T=s,e(),C&&o("left"),w&&o("right"))});var x;d&&f?(x="translate",b&&4.4>b&&(x="side")):x="jQuery",this.slidebars={open:o,close:a,toggle:l,init:function(){return y},active:function(t){return"left"===t&&m?C:"right"===t&&p?w:void 0},destroy:function(t){"left"===t&&m&&(C&&a(),setTimeout(function(){m.remove(),m=!1},400)),"right"===t&&p&&(w&&a(),setTimeout(function(){p.remove(),p=!1},400))}},t(".sb-toggle-left").on("touchend click",function(s){r(s,t(this)),l("left")}),t(".sb-toggle-right").on("touchend click",function(s){r(s,t(this)),l("right")}),t(".sb-open-left").on("touchend click",function(s){r(s,t(this)),o("left")}),t(".sb-open-right").on("touchend click",function(s){r(s,t(this)),o("right")}),t(".sb-close").on("touchend click",function(s){if(t(this).is("a")||t(this).children().is("a")){if("click"===s.type){s.preventDefault();var e=t(this).is("a")?t(this).attr("href"):t(this).find("a").attr("href");a(e)}}else r(s,t(this)),a()}),g.on("touchend click",function(s){c.siteClose&&(C||w)&&(r(s,t(this)),a())})}}(jQuery); \ No newline at end of file diff --git a/distribution/0.10.2/slidebars.css b/distribution/0.10.2/slidebars.css deleted file mode 100644 index c09b2d9..0000000 --- a/distribution/0.10.2/slidebars.css +++ /dev/null @@ -1,208 +0,0 @@ -/* ----------------------------------- - * Slidebars - * Version 0.10.2 - * http://plugins.adchsm.me/slidebars/ - * - * Written by Adam Smith - * http://www.adchsm.me/ - * - * Released under MIT License - * http://plugins.adchsm.me/slidebars/license.txt - * - * ------------------- - * Slidebars CSS Index - * - * 001 - Box Model, Html & Body - * 002 - Site - * 003 - Slidebars - * 004 - Animation - * 005 - Helper Classes - * - * ---------------------------- - * 001 - Box Model, Html & Body - */ - -html, body, #sb-site, .sb-site-container, .sb-slidebar { - /* Set box model to prevent any user added margins or paddings from altering the widths or heights. */ - margin: 0; - padding: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -html, body { - width: 100%; - overflow-x: hidden; /* Stops horizontal scrolling. */ -} - -html { - height: 100%; /* Site is as tall as device. */ -} - -body { - min-height: 100%; - height: auto; - position: relative; /* Required for static Slidebars to function properly. */ -} - -/* Site scroll locking - prevent site from scrolling when a Slidebar is open, except when static Slidebars are only available. */ -html.sb-scroll-lock.sb-active:not(.sb-static) { - overflow: hidden; -} - -/* ---------- - * 002 - Site - */ - -#sb-site, .sb-site-container { - /* You may now use class .sb-site-container instead of #sb-site and use your own id. However please make sure you don't set any of the following styles any differently on your id. */ - width: 100%; - position: relative; - z-index: 1; /* Site sits above Slidebars */ - background-color: #ffffff; /* Default background colour, overwrite this with your own css. I suggest moving your html or body background styling here. Making this transparent will allow the Slidebars beneath to be visible. */ -} - -/* --------------- - * 003 - Slidebars - */ - -.sb-slidebar { - height: 100%; - overflow-y: auto; /* Enable vertical scrolling on Slidebars when needed. */ - position: fixed; - top: 0; - z-index: 0; /* Slidebars sit behind sb-site. */ - display: none; /* Initially hide the Slidebars. Changed from visibility to display to allow -webkit-overflow-scrolling. */ - background-color: #222222; /* Default Slidebars background colour, overwrite this with your own css. */ - -webkit-transform: translate(0px); /* Fixes issues with translated and z-indexed elements on iOS 7. */ -} - -.sb-left { - left: 0; /* Set Slidebar to the left. */ -} - -.sb-right { - right: 0; /* Set Slidebar to the right. */ -} - -html.sb-static .sb-slidebar, -.sb-slidebar.sb-static { - position: absolute; /* Makes Slidebars scroll naturally with the site, and unfixes them for Android Browser < 3 and iOS < 5. */ -} - -.sb-slidebar.sb-active { - display: block; /* Makes Slidebars visibile when open. Changed from visibility to display to allow -webkit-overflow-scrolling. */ -} - -.sb-style-overlay { - z-index: 9999; /* Set z-index high to ensure it overlays any other site elements. */ -} - -.sb-momentum-scrolling { - -webkit-overflow-scrolling: touch; /* Adds native momentum scrolling for iOS & Android devices. */ -} - -/* Slidebar widths for browsers/devices that don't support media queries. */ - .sb-slidebar { - width: 30%; - } - - .sb-width-thin { - width: 15%; - } - - .sb-width-wide { - width: 45%; - } - -@media (max-width: 480px) { /* Slidebar widths on extra small screens. */ - .sb-slidebar { - width: 70%; - } - - .sb-width-thin { - width: 55%; - } - - .sb-width-wide { - width: 85%; - } -} - -@media (min-width: 481px) { /* Slidebar widths on small screens. */ - .sb-slidebar { - width: 55%; - } - - .sb-width-thin { - width: 40%; - } - - .sb-width-wide { - width: 70%; - } -} - -@media (min-width: 768px) { /* Slidebar widths on medium screens. */ - .sb-slidebar { - width: 40%; - } - - .sb-width-thin { - width: 25%; - } - - .sb-width-wide { - width: 55%; - } -} - -@media (min-width: 992px) { /* Slidebar widths on large screens. */ - .sb-slidebar { - width: 30%; - } - - .sb-width-thin { - width: 15%; - } - - .sb-width-wide { - width: 45%; - } -} - -@media (min-width: 1200px) { /* Slidebar widths on extra large screens. */ - .sb-slidebar { - width: 20%; - } - - .sb-width-thin { - width: 5%; - } - - .sb-width-wide { - width: 35%; - } -} - -/* --------------- - * 004 - Animation - */ - -.sb-slide, #sb-site, .sb-site-container, .sb-slidebar { - -webkit-transition: -webkit-transform 400ms ease; - -moz-transition: -moz-transform 400ms ease; - -o-transition: -o-transform 400ms ease; - transition: transform 400ms ease; - -webkit-transition-property: -webkit-transform, left, right; /* Add left/right for Android < 4.4. */ - -webkit-backface-visibility: hidden; /* Prevents flickering. This is non essential, and you may remove it if your having problems with fixed background images in Chrome. */ -} - -/* -------------------- - * 005 - Helper Classes - */ - -.sb-hide { - display: none; /* Optionally applied to control classes when Slidebars is disabled over a certain width. */ -} \ No newline at end of file diff --git a/distribution/0.10.2/slidebars.js b/distribution/0.10.2/slidebars.js deleted file mode 100644 index 8516d64..0000000 --- a/distribution/0.10.2/slidebars.js +++ /dev/null @@ -1,346 +0,0 @@ -// ----------------------------------- -// Slidebars -// Version 0.10.2 -// http://plugins.adchsm.me/slidebars/ -// -// Written by Adam Smith -// http://www.adchsm.me/ -// -// Released under MIT License -// http://plugins.adchsm.me/slidebars/license.txt -// -// --------------------- -// Index of Slidebars.js -// -// 001 - Default Settings -// 002 - Feature Detection -// 003 - User Agents -// 004 - Setup -// 005 - Animation -// 006 - Operations -// 007 - API -// 008 - User Input - -;(function($) { - - $.slidebars = function(options) { - - // ---------------------- - // 001 - Default Settings - - var settings = $.extend({ - siteClose: true, // true or false - Enable closing of Slidebars by clicking on #sb-site. - scrollLock: false, // true or false - Prevent scrolling of site when a Slidebar is open. - disableOver: false, // integer or false - Hide Slidebars over a specific width. - hideControlClasses: false // true or false - Hide controls at same width as disableOver. - }, options); - - // ----------------------- - // 002 - Feature Detection - - var test = document.createElement('div').style, // Create element to test on. - supportTransition = false, // Variable for testing transitions. - supportTransform = false; // variable for testing transforms. - - // Test for CSS Transitions - if (test.MozTransition === '' || test.WebkitTransition === '' || test.OTransition === '' || test.transition === '') supportTransition = true; - - // Test for CSS Transforms - if (test.MozTransform === '' || test.WebkitTransform === '' || test.OTransform === '' || test.transform === '') supportTransform = true; - - // ----------------- - // 003 - User Agents - - var ua = navigator.userAgent, // Get user agent string. - android = false, // Variable for storing android version. - iOS = false; // Variable for storing iOS version. - - if (/Android/.test(ua)) { // Detect Android in user agent string. - android = ua.substr(ua.indexOf('Android')+8, 3); // Set version of Android. - } else if (/(iPhone|iPod|iPad)/.test(ua)) { // Detect iOS in user agent string. - iOS = ua.substr(ua.indexOf('OS ')+3, 3).replace('_', '.'); // Set version of iOS. - } - - if (android && android < 3 || iOS && iOS < 5) $('html').addClass('sb-static'); // Add helper class for older versions of Android & iOS. - - // ----------- - // 004 - Setup - - // Site container - var $site = $('#sb-site, .sb-site-container'); // Cache the selector. - - // Left Slidebar - if ($('.sb-left').length) { // Check if the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check if the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - } - - var init = false, // Initialisation variable. - windowWidth = $(window).width(), // Get width of window. - $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'), // Cache the control classes. - $slide = $('.sb-slide'); // Cache users elements to animate. - - // Initailise Slidebars - function initialise() { - if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. - init = true; // true enabled Slidebars to open. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.removeClass('sb-hide'); // Remove class just incase Slidebars was originally disabled. - css(); // Set required inline styles. - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. - init = false; // false stop Slidebars from opening. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.addClass('sb-hide'); // Hide controls - $site.css('minHeight', ''); // Remove minimum height. - if (leftActive || rightActive) close(); // Close Slidebars if open. - } - } - initialise(); - - // Inline CSS - function css() { - // Set minimum height. - $site.css('minHeight', ''); // Reset minimum height. - $site.css('minHeight', $('html').height() + 'px'); // Set minimum height of the site to the minimum height of the html. - - // Custom Slidebar widths. - if ($left && $left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - if ($right && $right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. - - // Set off-canvas margins for Slidebars with push and overlay animations. - if ($left && ($left.hasClass('sb-style-push') || $left.hasClass('sb-style-overlay'))) $left.css('marginLeft', '-' + $left.css('width')); - if ($right && ($right.hasClass('sb-style-push') || $right.hasClass('sb-style-overlay'))) $right.css('marginRight', '-' + $right.css('width')); - - // Site scroll locking. - if (settings.scrollLock) $('html').addClass('sb-scroll-lock'); - } - - // Resize Functions - $(window).resize(function() { - var resizedWindowWidth = $(window).width(); // Get resized window width. - if (windowWidth !== resizedWindowWidth) { // Slidebars is running and window was actually resized. - windowWidth = resizedWindowWidth; // Set the new window width. - initialise(); // Call initalise to see if Slidebars should still be running. - if (leftActive) open('left'); // If left Slidebar is open, calling open will ensure it is the correct size. - if (rightActive) open('right'); // If right Slidebar is open, calling open will ensure it is the correct size. - } - }); - // I may include a height check along side a width check here in future. - - // --------------- - // 005 - Animation - - var animation; // Animation type. - - // Set animation type. - if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. - animation = 'translate'; // Translate for browsers that support it. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - - // Animate mixin. - function animate(object, amount, side) { - // Choose selectors depending on animation style. - var selector; - - if (object.hasClass('sb-style-push')) { - selector = $site.add(object).add($slide); // Push - Animate site, Slidebar and user elements. - } else if (object.hasClass('sb-style-overlay')) { - selector = object; // Overlay - Animate Slidebar only. - } else { - selector = $site.add($slide); // Reveal - Animate site and user elements. - } - - // Apply animation - if (animation === 'translate') { - selector.css('transform', 'translate(' + amount + ')'); // Apply the animation. - - } else if (animation === 'side') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for side animations. - if (amount !== '0px') selector.css(side, '0px'); // Add a 0 value so css transition works. - setTimeout(function() { // Set a timeout to allow the 0 value to be applied above. - selector.css(side, amount); // Apply the animation. - }, 1); - - } else if (animation === 'jQuery') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for jQuery animations. - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); // Stop any current jQuery animation before starting another. - } - - // If closed, remove the inline styling on completion of the animation. - setTimeout(function() { - if (amount === '0px') { - selector.removeAttr('style'); - css(); - } - }, 400); - } - - // ---------------- - // 006 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - $left.addClass('sb-active'); - animate($left, $left.css('width'), 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - $right.addClass('sb-active'); - animate($right, '-' + $right.css('width'), 'right'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. - } - } - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - if (leftActive) { - animate($left, '0px', 'left'); // Animation - leftActive = false; - } - if (rightActive) { - animate($right, '0px', 'right'); // Animation - rightActive = false; - } - - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if ($left) $left.removeClass('sb-active'); - if ($right) $right.removeClass('sb-active'); - if (typeof link !== 'undefined') window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - } - - // --------- - // 007 - API - - this.slidebars = { - open: open, // Maps user variable name to the open method. - close: close, // Maps user variable name to the close method. - toggle: toggle, // Maps user variable name to the toggle method. - init: function() { // Returns true or false whether Slidebars are running or not. - return init; // Returns true or false whether Slidebars are running. - }, - active: function(side) { // Returns true or false whether Slidebar is open or closed. - if (side === 'left' && $left) return leftActive; - if (side === 'right' && $right) return rightActive; - }, - destroy: function(side) { // Removes the Slidebar from the DOM. - if (side === 'left' && $left) { - if (leftActive) close(); // Close if its open. - setTimeout(function() { - $left.remove(); // Remove it. - $left = false; // Set variable to false so it cannot be opened again. - }, 400); - } - if (side === 'right' && $right) { - if (rightActive) close(); // Close if its open. - setTimeout(function() { - $right.remove(); // Remove it. - $right = false; // Set variable to false so it cannot be opened again. - }, 400); - } - } - }; - - // ---------------- - // 008 - User Input - - function eventHandler(event, selector) { - event.stopPropagation(); // Stop event bubbling. - event.preventDefault(); // Prevent default behaviour. - if (event.type === 'touchend') selector.off('click'); // If event type was touch, turn off clicks to prevent phantom clicks. - } - - // Toggle left Slidebar - $('.sb-toggle-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('left'); // Toggle the left Slidbar. - }); - - // Toggle right Slidebar - $('.sb-toggle-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('right'); // Toggle the right Slidbar. - }); - - // Open left Slidebar - $('.sb-open-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('left'); // Open the left Slidebar. - }); - - // Open right Slidebar - $('.sb-open-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('right'); // Open the right Slidebar. - }); - - // Close Slidebar - $('.sb-close').on('touchend click', function(event) { - if ( $(this).is('a') || $(this).children().is('a') ) { // Is a link or contains a link. - if ( event.type === 'click' ) { // Make sure the user wanted to follow the link. - event.preventDefault(); // Stop default behaviour. - var href = ( $(this).is('a') ? $(this).attr('href') : $(this).find('a').attr('href') ); // Get the href. - close( href ); // Close Slidebar and pass link. - } - } else { // Just a normal control class. - eventHandler(event, $(this)); // Handle the event. - close(); // Close Slidebar. - } - }); - - // Close Slidebar via site - $site.on('touchend click', function(event) { - if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. - eventHandler(event, $(this)); // Handle the event. - close(); // Close it. - } - }); - - }; // End Slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.10.2/slidebars.min.css b/distribution/0.10.2/slidebars.min.css deleted file mode 100644 index e9dca52..0000000 --- a/distribution/0.10.2/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.10.2 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt) */ -#sb-site,.sb-site-container,.sb-slidebar,body,html{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body,html{width:100%;overflow-x:hidden}html{height:100%}body{min-height:100%;height:auto;position:relative}html.sb-scroll-lock.sb-active:not(.sb-static){overflow:hidden}#sb-site,.sb-site-container{width:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;display:none;background-color:#222;-webkit-transform:translate(0px)}.sb-left{left:0}.sb-right{right:0}.sb-slidebar.sb-static,html.sb-static .sb-slidebar{position:absolute}.sb-slidebar.sb-active{display:block}.sb-style-overlay{z-index:9999}.sb-momentum-scrolling{-webkit-overflow-scrolling:touch}.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}@media (max-width:480px){.sb-slidebar{width:70%}.sb-width-thin{width:55%}.sb-width-wide{width:85%}}@media (min-width:481px){.sb-slidebar{width:55%}.sb-width-thin{width:40%}.sb-width-wide{width:70%}}@media (min-width:768px){.sb-slidebar{width:40%}.sb-width-thin{width:25%}.sb-width-wide{width:55%}}@media (min-width:992px){.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}}@media (min-width:1200px){.sb-slidebar{width:20%}.sb-width-thin{width:5%}.sb-width-wide{width:35%}}#sb-site,.sb-site-container,.sb-slide,.sb-slidebar{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left,right;-webkit-backface-visibility:hidden}.sb-hide{display:none} \ No newline at end of file diff --git a/distribution/0.10.2/slidebars.min.js b/distribution/0.10.2/slidebars.min.js deleted file mode 100644 index 528522d..0000000 --- a/distribution/0.10.2/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.10.2 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt) -!function(t){t.slidebars=function(s){function e(){!c.disableOver||"number"==typeof c.disableOver&&c.disableOver>=T?(y=!0,t("html").addClass("sb-init"),c.hideControlClasses&&k.removeClass("sb-hide"),i()):"number"==typeof c.disableOver&&c.disableOverb||v&&5>v)&&t("html").addClass("sb-static");var g=t("#sb-site, .sb-site-container");if(t(".sb-left").length)var m=t(".sb-left"),C=!1;if(t(".sb-right").length)var p=t(".sb-right"),w=!1;var y=!1,T=t(window).width(),k=t(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"),O=t(".sb-slide");e(),t(window).resize(function(){var s=t(window).width();T!==s&&(T=s,e(),C&&o("left"),w&&o("right"))});var x;d&&f?(x="translate",b&&4.4>b&&(x="side")):x="jQuery",this.slidebars={open:o,close:a,toggle:l,init:function(){return y},active:function(t){return"left"===t&&m?C:"right"===t&&p?w:void 0},destroy:function(t){"left"===t&&m&&(C&&a(),setTimeout(function(){m.remove(),m=!1},400)),"right"===t&&p&&(w&&a(),setTimeout(function(){p.remove(),p=!1},400))}},t(".sb-toggle-left").on("touchend click",function(s){r(s,t(this)),l("left")}),t(".sb-toggle-right").on("touchend click",function(s){r(s,t(this)),l("right")}),t(".sb-open-left").on("touchend click",function(s){r(s,t(this)),o("left")}),t(".sb-open-right").on("touchend click",function(s){r(s,t(this)),o("right")}),t(".sb-close").on("touchend click",function(s){if(t(this).is("a")||t(this).children().is("a")){if("click"===s.type){s.preventDefault();var e=t(this).is("a")?t(this).attr("href"):t(this).find("a").attr("href");a(e)}}else r(s,t(this)),a()}),g.on("touchend click",function(s){c.siteClose&&(C||w)&&(r(s,t(this)),a())})}}(jQuery); \ No newline at end of file diff --git a/distribution/0.10/slidebars.css b/distribution/0.10/slidebars.css deleted file mode 100644 index 4c23f3f..0000000 --- a/distribution/0.10/slidebars.css +++ /dev/null @@ -1,207 +0,0 @@ -/* ----------------------------------- - * Slidebars - * Version 0.10 - * http://plugins.adchsm.me/slidebars/ - * - * Written by Adam Smith - * http://www.adchsm.me/ - * - * Released under MIT License - * http://plugins.adchsm.me/slidebars/license.txt - * - * ------------------- - * Slidebars CSS Index - * - * 001 - Box Model, Html & Body - * 002 - Site - * 003 - Slidebars - * 004 - Animation - * 005 - Helper Classes - * - * ---------------------------- - * 001 - Box Model, Html & Body - */ - -html, body, #sb-site, .sb-site-container, .sb-slidebar { - /* Set box model to prevent any user added margins or paddings from altering the widths or heights. */ - margin: 0; - padding: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -html, body { - width: 100%; - overflow-x: hidden; /* Stops horizontal scrolling. */ -} - -html { - height: 100%; /* Site is as tall as device. */ -} - -body { - min-height: 100%; - height: auto; - position: relative; /* Required for static Slidebars to function properly. */ -} - -html.sb-scroll-lock.sb-active:not(.sb-static) { - overflow: hidden; /* Prevent site from scrolling when a Slidebar is open, except when static Slidebars are only available. */ -} - -/* ---------- - * 002 - Site - */ - -#sb-site, .sb-site-container { - /* You may now use class .sb-site-container instead of #sb-site and use your own id. However please make sure you don't set any of the following styles any differently on your id. */ - width: 100%; - position: relative; - z-index: 1; /* Site sits above Slidebars */ - background-color: #ffffff; /* Default background colour, overwrite this with your own css. I suggest moving your html or body background styling here. Making this transparent will allow the Slidebars beneath to be visible. */ -} - -/* --------------- - * 003 - Slidebars - */ - -.sb-slidebar { - height: 100%; - overflow-y: auto; /* Enable vertical scrolling on Slidebars when needed. */ - position: fixed; - top: 0; - z-index: 0; /* Slidebars sit behind sb-site. */ - display: none; /* Initially hide the Slidebars. Changed from visibility to display to allow -webkit-overflow-scrolling. */ - background-color: #222222; /* Default Slidebars background colour, overwrite this with your own css. */ - -webkit-transform: translate(0px); /* Fixes issues with translated and z-indexed elements on iOS 7. */ -} - -.sb-left { - left: 0; /* Set Slidebar to the left. */ -} - -.sb-right { - right: 0; /* Set Slidebar to the right. */ -} - -html.sb-static .sb-slidebar, -.sb-slidebar.sb-static { - position: absolute; /* Makes Slidebars scroll naturally with the site, and unfixes them for Android Browser < 3 and iOS < 5. */ -} - -.sb-slidebar.sb-active { - display: block; /* Makes Slidebars visibile when open. Changed from visibility to display to allow -webkit-overflow-scrolling. */ -} - -.sb-style-overlay { - z-index: 9999; /* Set z-index high to ensure it overlays any other site elements. */ -} - -.sb-momentum-scrolling { - -webkit-overflow-scrolling: touch; /* Adds native momentum scrolling for iOS & Android devices. */ -} - -/* Slidebar widths for browsers/devices that don't support media queries. */ - .sb-slidebar { - width: 30%; - } - - .sb-width-thin { - width: 15%; - } - - .sb-width-wide { - width: 45%; - } - -@media (max-width: 480px) { /* Slidebar widths on extra small screens. */ - .sb-slidebar { - width: 70%; - } - - .sb-width-thin { - width: 55%; - } - - .sb-width-wide { - width: 85%; - } -} - -@media (min-width: 481px) { /* Slidebar widths on small screens. */ - .sb-slidebar { - width: 55%; - } - - .sb-width-thin { - width: 40%; - } - - .sb-width-wide { - width: 70%; - } -} - -@media (min-width: 768px) { /* Slidebar widths on medium screens. */ - .sb-slidebar { - width: 40%; - } - - .sb-width-thin { - width: 25%; - } - - .sb-width-wide { - width: 55%; - } -} - -@media (min-width: 992px) { /* Slidebar widths on large screens. */ - .sb-slidebar { - width: 30%; - } - - .sb-width-thin { - width: 15%; - } - - .sb-width-wide { - width: 45%; - } -} - -@media (min-width: 1200px) { /* Slidebar widths on extra large screens. */ - .sb-slidebar { - width: 20%; - } - - .sb-width-thin { - width: 5%; - } - - .sb-width-wide { - width: 35%; - } -} - -/* --------------- - * 004 - Animation - */ - -.sb-slide, #sb-site, .sb-site-container, .sb-slidebar { - -webkit-transition: -webkit-transform 400ms ease; - -moz-transition: -moz-transform 400ms ease; - -o-transition: -o-transform 400ms ease; - transition: transform 400ms ease; - -webkit-transition-property: -webkit-transform, left, right; /* Add left/right for Android < 4.4. */ - -webkit-backface-visibility: hidden; /* Prevents flickering. This is non essential, and you may remove it if your having problems with fixed background images in Chrome. */ -} - -/* -------------------- - * 005 - Helper Classes - */ - -.sb-hide { - display: none; /* Optionally applied to control classes when Slidebars is disabled over a certain width. */ -} \ No newline at end of file diff --git a/distribution/0.10/slidebars.js b/distribution/0.10/slidebars.js deleted file mode 100644 index cf24fbb..0000000 --- a/distribution/0.10/slidebars.js +++ /dev/null @@ -1,349 +0,0 @@ -// ----------------------------------- -// Slidebars -// Version 0.10 -// http://plugins.adchsm.me/slidebars/ -// -// Written by Adam Smith -// http://www.adchsm.me/ -// -// Released under MIT License -// http://plugins.adchsm.me/slidebars/license.txt -// -// --------------------- -// Index of Slidebars.js -// -// 001 - Default Settings -// 002 - Feature Detection -// 003 - User Agents -// 004 - Setup -// 005 - Animation -// 006 - Operations -// 007 - API -// 008 - User Input - -;(function($) { - - $.slidebars = function(options) { - - // ---------------------- - // 001 - Default Settings - - var settings = $.extend({ - siteClose: true, // true or false - Enable closing of Slidebars by clicking on #sb-site. - scrollLock: false, // true or false - Prevent scrolling of site when a Slidebar is open. - disableOver: false, // integer or false - Hide Slidebars over a specific width. - hideControlClasses: false // true or false - Hide controls at same width as disableOver. - }, options); - - // ----------------------- - // 002 - Feature Detection - - var test = document.createElement('div').style, // Create element to test on. - supportTransition = false, // Variable for testing transitions. - supportTransform = false; // variable for testing transforms. - - // Test for CSS Transitions - if (test.MozTransition === '' || test.WebkitTransition === '' || test.OTransition === '' || test.transition === '') supportTransition = true; - - // Test for CSS Transforms - if (test.MozTransform === '' || test.WebkitTransform === '' || test.OTransform === '' || test.transform === '') supportTransform = true; - - // ----------------- - // 003 - User Agents - - var ua = navigator.userAgent, // Get user agent string. - android = false, // Variable for storing android version. - iOS = false; // Variable for storing iOS version. - - if (/Android/.test(ua)) { // Detect Android in user agent string. - android = ua.substr(ua.indexOf('Android')+8, 3); // Set version of Android. - } else if (/(iPhone|iPod|iPad)/.test(ua)) { // Detect iOS in user agent string. - iOS = ua.substr(ua.indexOf('OS ')+3, 3).replace('_', '.'); // Set version of iOS. - } - - if (android && android < 3 || iOS && iOS < 5) $('html').addClass('sb-static'); // Add helper class for older versions of Android & iOS. - - // ----------- - // 004 - Setup - - // Site container - var $site = $('#sb-site, .sb-site-container'); // Cache the selector. - - // Left Slidebar - if ($('.sb-left').length) { // Check if the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check if the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - } - - var init = false, // Initialisation variable. - windowWidth = $(window).width(), // Get width of window. - $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'), // Cache the control classes. - $slide = $('.sb-slide'); // Cache users elements to animate. - - // Initailise Slidebars - function initialise() { - if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. - init = true; // true enabled Slidebars to open. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.removeClass('sb-hide'); // Remove class just incase Slidebars was originally disabled. - css(); // Set required inline styles. - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. - init = false; // false stop Slidebars from opening. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.addClass('sb-hide'); // Hide controls - $site.css('minHeight', ''); // Remove minimum height. - if (leftActive || rightActive) close(); // Close Slidebars if open. - } - } - initialise(); - - // Inline CSS - function css() { - // Set minimum height. - $site.css('minHeight', ''); // Reset minimum height. - $site.css('minHeight', $('html').height() + 'px'); // Set minimum height of the site to the minimum height of the html. - - // Custom Slidebar widths. - if ($left && $left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - if ($right && $right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. - - // Set off-canvas margins for Slidebars with push and overlay animations. - if ($left && ($left.hasClass('sb-style-push') || $left.hasClass('sb-style-overlay'))) $left.css('marginLeft', '-' + $left.css('width')); - if ($right && ($right.hasClass('sb-style-push') || $right.hasClass('sb-style-overlay'))) $right.css('marginRight', '-' + $right.css('width')); - - // Site scroll locking. - if (settings.scrollLock) $('html').addClass('sb-scroll-lock'); - } - - // Resize Functions - $(window).resize(function() { - var resizedWindowWidth = $(window).width(); // Get resized window width. - if (windowWidth !== resizedWindowWidth) { // Slidebars is running and window was actually resized. - windowWidth = resizedWindowWidth; // Set the new window width. - initialise(); // Call initalise to see if Slidebars should still be running. - if (leftActive) open('left'); // If left Slidebar is open, calling open will ensure it is the correct size. - if (rightActive) open('right'); // If right Slidebar is open, calling open will ensure it is the correct size. - } - }); - // I may include a height check along side a width check here in future. - - // --------------- - // 005 - Animation - - var animation; // Animation type. - - // Set animation type. - if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. - animation = 'translate'; // Translate for browsers that support it. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - - // Animate mixin. - function animate(object, amount, side) { - // Choose selectors depending on animation style. - var selector; - - if (object.hasClass('sb-style-push')) { - selector = $site.add(object).add($slide); // Push - Animate site, Slidebar and user elements. - } else if (object.hasClass('sb-style-overlay')) { - selector = object; // Overlay - Animate Slidebar only. - } else { - selector = $site.add($slide); // Reveal - Animate site and user elements. - } - - // Apply animation - if (animation === 'translate') { - selector.css('transform', 'translate(' + amount + ')'); // Apply the animation. - - } else if (animation === 'side') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for side animations. - if (amount !== '0px') selector.css(side, '0px'); // Add a 0 value so css transition works. - setTimeout(function() { // Set a timeout to allow the 0 value to be applied above. - selector.css(side, amount); // Apply the animation. - }, 1); - - } else if (animation === 'jQuery') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for jQuery animations. - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); // Stop any current jQuery animation before starting another. - } - - // If closed, remove the inline styling on completion of the animation. - setTimeout(function() { - if (amount === '0px') { - selector.removeAttr('style'); - css(); - } - }, 400); - } - - // ---------------- - // 006 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - $left.addClass('sb-active'); - animate($left, $left.css('width'), 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - $right.addClass('sb-active'); - animate($right, '-' + $right.css('width'), 'right'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. - } - } - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - if (leftActive) { - animate($left, '0px', 'left'); // Animation - leftActive = false; - } - if (rightActive) { - animate($right, '0px', 'right'); // Animation - rightActive = false; - } - - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if ($left) $left.removeClass('sb-active'); - if ($right) $right.removeClass('sb-active'); - if (typeof link !== 'undefined') window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - } - - // --------- - // 007 - API - - this.slidebars = { - open: open, // Maps user variable name to the open method. - close: close, // Maps user variable name to the close method. - toggle: toggle, // Maps user variable name to the toggle method. - init: function() { // Returns true or false whether Slidebars are running or not. - return init; // Returns true or false whether Slidebars are running. - }, - active: function(side) { // Returns true or false whether Slidebar is open or closed. - if (side === 'left' && $left) return leftActive; - if (side === 'right' && $right) return rightActive; - }, - destroy: function(side) { // Removes the Slidebar from the DOM. - if (side === 'left' && $left) { - if (leftActive) close(); // Close if its open. - setTimeout(function() { - $left.remove(); // Remove it. - $left = false; // Set variable to false so it cannot be opened again. - }, 400); - } - if (side === 'right' && $right) { - if (rightActive) close(); // Close if its open. - setTimeout(function() { - $right.remove(); // Remove it. - $right = false; // Set variable to false so it cannot be opened again. - }, 400); - } - } - }; - - // ---------------- - // 008 - User Input - - function eventHandler(event, selector) { - event.stopPropagation(); // Stop event bubbling. - event.preventDefault(); // Prevent default behaviour - if (event.type === 'touchend') selector.off('click'); // If event type was touch turn off clicks to prevent phantom clicks. - } - - // Toggle left Slidebar - $('.sb-toggle-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('left'); // Toggle the left Slidbar. - }); - - // Toggle right Slidebar - $('.sb-toggle-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('right'); // Toggle the right Slidbar. - }); - - // Open left Slidebar - $('.sb-open-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('left'); // Open the left Slidebar. - }); - - // Open right Slidebar - $('.sb-open-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('right'); // Open the right Slidebar. - }); - - // Close a Slidebar - $('.sb-close').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - var link; - - // Close Slidebar via link - if ( $(this).parents('.sb-slidebar') ) { - if ( $(this).is('a') ) { - link = $(this).attr('href'); - } else if ( $(this).children('a') ) { - link = $(this).children('a').attr('href'); - } - } - - close(link); // Close Slidebar and pass link. - }); - - // Close Slidebar via site - $site.on('touchend click', function(event) { - if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. - eventHandler(event, $(this)); // Handle the event. - close(); // Close it. - } - }); - - }; // End Slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.10/slidebars.min.css b/distribution/0.10/slidebars.min.css deleted file mode 100644 index 9ab907d..0000000 --- a/distribution/0.10/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.10 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt) */ -#sb-site,.sb-site-container,.sb-slidebar,body,html{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body,html{width:100%;overflow-x:hidden}html{height:100%}body{min-height:100%;height:auto;position:relative}html.sb-scroll-lock.sb-active:not(.sb-static){overflow:hidden}#sb-site,.sb-site-container{width:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;display:none;background-color:#222;-webkit-transform:translate(0px)}.sb-left{left:0}.sb-right{right:0}.sb-slidebar.sb-static,html.sb-static .sb-slidebar{position:absolute}.sb-slidebar.sb-active{display:block}.sb-style-overlay{z-index:9999}.sb-momentum-scrolling{-webkit-overflow-scrolling:touch}.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}@media (max-width:480px){.sb-slidebar{width:70%}.sb-width-thin{width:55%}.sb-width-wide{width:85%}}@media (min-width:481px){.sb-slidebar{width:55%}.sb-width-thin{width:40%}.sb-width-wide{width:70%}}@media (min-width:768px){.sb-slidebar{width:40%}.sb-width-thin{width:25%}.sb-width-wide{width:55%}}@media (min-width:992px){.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}}@media (min-width:1200px){.sb-slidebar{width:20%}.sb-width-thin{width:5%}.sb-width-wide{width:35%}}#sb-site,.sb-site-container,.sb-slide,.sb-slidebar{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left,right;-webkit-backface-visibility:hidden}.sb-hide{display:none} \ No newline at end of file diff --git a/distribution/0.10/slidebars.min.js b/distribution/0.10/slidebars.min.js deleted file mode 100644 index b6ebc5f..0000000 --- a/distribution/0.10/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.10 (http://plugins.adchsm.me/slidebars/) written by Adam Smith (http://www.adchsm.me/) released under MIT License (http://plugins.adchsm.me/slidebars/license.txt) -!function(t){t.slidebars=function(s){function e(){!c.disableOver||"number"==typeof c.disableOver&&c.disableOver>=T?(y=!0,t("html").addClass("sb-init"),c.hideControlClasses&&k.removeClass("sb-hide"),i()):"number"==typeof c.disableOver&&c.disableOveru||v&&5>v)&&t("html").addClass("sb-static");var g=t("#sb-site, .sb-site-container");if(t(".sb-left").length)var m=t(".sb-left"),C=!1;if(t(".sb-right").length)var p=t(".sb-right"),w=!1;var y=!1,T=t(window).width(),k=t(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"),O=t(".sb-slide");e(),t(window).resize(function(){var s=t(window).width();T!==s&&(T=s,e(),C&&o("left"),w&&o("right"))});var x;d&&f?(x="translate",u&&4.4>u&&(x="side")):x="jQuery",this.slidebars={open:o,close:a,toggle:l,init:function(){return y},active:function(t){return"left"===t&&m?C:"right"===t&&p?w:void 0},destroy:function(t){"left"===t&&m&&(C&&a(),setTimeout(function(){m.remove(),m=!1},400)),"right"===t&&p&&(w&&a(),setTimeout(function(){p.remove(),p=!1},400))}},t(".sb-toggle-left").on("touchend click",function(s){r(s,t(this)),l("left")}),t(".sb-toggle-right").on("touchend click",function(s){r(s,t(this)),l("right")}),t(".sb-open-left").on("touchend click",function(s){r(s,t(this)),o("left")}),t(".sb-open-right").on("touchend click",function(s){r(s,t(this)),o("right")}),t(".sb-close").on("touchend click",function(s){r(s,t(this));var e;t(this).parents(".sb-slidebar")&&(t(this).is("a")?e=t(this).attr("href"):t(this).children("a")&&(e=t(this).children("a").attr("href"))),a(e)}),g.on("touchend click",function(s){c.siteClose&&(C||w)&&(r(s,t(this)),a())})}}(jQuery); \ No newline at end of file diff --git a/distribution/0.7.1/slidebars.css b/distribution/0.7.1/slidebars.css deleted file mode 100644 index 91707ec..0000000 --- a/distribution/0.7.1/slidebars.css +++ /dev/null @@ -1,130 +0,0 @@ -/* ----------------------------------- - * Slidebars - * Version 0.7.1 - * http://plugins.adchsm.me/slidebars/ - * - * Written by Adam Smith - * http://www.adchsm.me/ - * - * Released under MIT License - * http://opensource.org/licenses/MIT - * - * ------------------- - * Slidebars CSS Index - * - * 001 - Box Model, Html & Body - * 002 - Site - * 003 - Slidebars - * 004 - Animation - * - * ---------------------------- - * 001 - Box Model, Html & Body - */ - -html, body, #sb-site, .sb-slidebar { - margin: 0; - padding: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -html, body { - width: 100%; - overflow-x: hidden; -} - -html { - height: 100%; -} - -body { - min-height: 100%; -} - -/* ---------- - * 002 - Site - */ - -#sb-site { - width: 100%; - min-height: 100%; /* Initially set here but accurate height is set by slidebars.js */ - position: relative; - z-index: 1; /* Site sits above Slidebars */ - /*box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0); Fixes some translation issues. */ - background-color: #ffffff; /* Default background colour, overwrite this with your own css. */ -} - -/* --------------- - * 003 - Slidebars - */ - -.sb-slidebar { - width: 35%; /* Slidebar width for older browsers that don't support media queries. */ - height: 100%; - overflow-y: auto; /* Enable vertical scrolling on Slidebars when needed. */ - position: fixed; - top: 0; - z-index: 0; /* Slidebars sit behind sb-site. */ - visibility: hidden; /* Initially hide the Slidebars. */ - background-color: #222222; /* Default Slidebars background colour, overwrite this with your own css. */ -} - -html.sb-android .sb-slidebar { /* Unfix Slidebars for Android Browser < 3 */ - height: auto; - position: absolute; -} - -.sb-left { - left: 0; -} - -.sb-right { - right: 0; -} - -html.sb-active-left .sb-left { - visibility: visible; -} - -html.sb-active-right .sb-right { - visibility: visible; -} - -/* Media queries to set Slidebar widths. */ -@media (max-width: 480px) { - .sb-slidebar { - width: 70%; /* Slidebar width on extra small screens. */ - } -} - -@media (min-width: 481px) and (max-width: 991px) { - .sb-slidebar { - width: 50%; /* Slidebar width on small screens. */ - } -} - -@media (min-width: 992px) { - .sb-slidebar { - width: 35%; /* Slidebar width on medium screens. */ - } -} - -@media (min-width: 1200px) { - .sb-slidebar { - width: 20%; /* Slidebar width on large screens. */ - } -} - -/* --------------- - * 004 - Animation - */ - -html.sb-anim-type-translate .sb-slide, html.sb-anim-type-side .sb-slide { - -webkit-transition: -webkit-transform 400ms ease; - -moz-transition: -moz-transform 400ms ease; - -o-transition: -o-transform 400ms ease; - transition: transform 400ms ease; - -webkit-transition-property: -webkit-transform, left; /* Add 'left' for Android < 4.4 */ - -webkit-backface-visibility: hidden; /* Prevents flickering. */ -} \ No newline at end of file diff --git a/distribution/0.7.1/slidebars.js b/distribution/0.7.1/slidebars.js deleted file mode 100644 index f4a9c91..0000000 --- a/distribution/0.7.1/slidebars.js +++ /dev/null @@ -1,271 +0,0 @@ -// ----------------------------------- -// Slidebars -// Version 0.7.1 -// http://plugins.adchsm.me/slidebars/ -// -// Written by Adam Smith -// http://www.adchsm.me/ -// -// Released under MIT License -// http://opensource.org/licenses/MIT -// -// --------------------- -// Index of Slidebars.js -// -// 001 - Options -// 002 - Feature Detection -// 003 - User Agents -// 004 - Initialisation -// 005 - Animation -// 006 - Operations -// 007 - API -// 008 - Window Resizes -// 009 - User Input - -;(function($) { - - $.slidebars = function(options) { - - // ---------------------- - // 001 - Default Settings - - var settings = $.extend({ - siteClose: true // true or false - Enable closing of Slidebars by clicking on #sb-site. - }, options); - - // ----------------------- - // 001 - Feature Detection - - var test = document.createElement('div').style, - supportTransition = false, - supportTransform = false; - - // CSS Transitions - if (test.MozTransition === '' || test.WebkitTransition === '' || test.OTransition === '' || test.transition === '') supportTransition = true; - - // CSS Transforms - if (test.MozTransform === '' || test.WebkitTransform === '' || test.OTransform === '' || test.transform === '') supportTransform = true; - - // ----------------- - // 002 - User Agents - - // Get User Agent String - var ua = navigator.userAgent, - android = false; - - // Detect Android - if (ua.match(/Android/)) {// The user agent is Android. - android = parseFloat(ua.slice(ua.indexOf('Android')+8)); // Get version of Android. - if (android < 3) $('html').addClass('sb-android'); // Add 'sb-android' helper class for unfixing elements. - } - - // -------------------- - // 003 - Initialisation - - this.init = true; // User check, returns true if Slidebars has been initiated. - - // Site Container - if (!$('#sb-site').length) { // Check if user has wrapped their content with an id of sb-site. - // .sb-site doesn't exist, create it. - $('body').children().wrapAll('
'); - } - var $site = $('#sb-site'); // Cache the selector. - if (!$site.parent().is('body')) $site.appendTo('body'); // Check its location and move if necessary. - $site.addClass('sb-slide'); // Add animation class. - - // Left Slidebar - if ($('.sb-left').length) { // Check the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - if (!$left.parent().is('body')) $left.appendTo('body'); // Check its location and move if necessary. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - if (!$right.parent().is('body')) $right.appendTo('body'); // Check its location and move if necessary. - } - - // Set Minimum Height - function setMinHeights() { - var htmlHeight = $('html').css('height'); - $site.css({ - 'min-height': htmlHeight - }); - if (android && android < 3) { - $('.sb-slidebar').css({ - 'min-height': htmlHeight - }); - } - } - setMinHeights(); - - // --------------- - // 004 - Animation - - var animation, // Animation type. - $slide = $('.sb-slide'); // Cache all elements to animate. - - // Set animation type. - if (supportTransition && supportTransform) { // CSS Transitions - animation = 'translate'; - if (android && android < 4.4) animation = 'side'; - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - if (settings.animType) animation = settings.animType; // Force animation type, for testing purposes only. - - $('html').addClass('sb-anim-type-' + animation); // Add animation type class. - - // Animate Mixin - var animate = function(selector, amount, side) { - if (animation === 'translate') { - selector.css({ - 'transform': 'translate(' + amount + ')' - }); - } else if (animation === 'side') { - selector.css(side, amount); - } else if (animation === 'jQuery') { - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); - } - }; - - // ---------------- - // 003 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { - // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { - // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (side === 'left' && $left) { // Open left Slidebar and make sure the left Slidebar is in use. - leftActive = true; // Set active variables. - var leftWidth = $left.css('width'); // Get the width of the left Slidebar. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - animate($slide, leftWidth, 'left'); // Animation - } else if (side === 'right' && $right) { // Open right Slidebar and make sure the right Slidebar is in use. - rightActive = true; // Set active variables. - var rightWidth = $right.css('width'); // Get the width of the right Slidebar. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - animate($slide, '-' + rightWidth, 'left');// Animation - } // End if side = left/right. - - // Enable closing by sb-site. - if (settings.siteClose && (side === 'left' && leftActive || side === 'right' && rightActive)) { // If a Slidebar was opened. - $site.off('touchend click'); // Turn off click close incase this was called by a window resize. - setTimeout(function() { - $site.one('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - close(); - }); - }, 400); - } - } // End proceed - - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - leftActive = false; // Set active variable. - rightActive = false; // Set active variable. - $site.off('touchend click'); // Turn off closing by .sb-site. - animate($slide, '0px', 'left');// Animation - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if (link) window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side == 'left' && $left) { // If left Slidebar is called and in use. - if (leftActive) { - close(); // Slidebar is open, close it. - } else if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } - } else if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (rightActive) { - close(); // Slidebar is open, close it. - } else if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } - } - } - - // --------- - // 004 - API - - this.open = open; // Maps user variable name to the open method. - this.close = close; // Maps user variable name to the close method. - this.toggle = toggle; // Maps user variable name to the toggle method. - - // -------------------- - // 005 - Window Resizes - - function resize() { - setMinHeights(); // Reset the minimum height of the site. - if (leftActive) { // Left Slidebar is open whilst the window is resized. - open('left'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } else if (rightActive) { // Right Slidebar is open whilst the window is resized. - open('right'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } - } - $(window).resize(resize); - - // ---------------- - // 006 - User Input - - // Slidebar Toggle Left - $('.sb-toggle-left').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - toggle('left'); - }); - - // Slidebar Toggle Right - $('.sb-toggle-right').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - toggle('right'); - }); - - // Slidebar Left Open - $('.sb-open-left').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - if (!leftActive) open('left'); // Slidebar is closed, open it. - }); - - // Slidebar Right Open - $('.sb-open-right').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - if (!rightActive) open('right'); // Slidebar is closed, open it. - }); - - // Slidebar Close - $('.sb-close').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - if (leftActive || rightActive) close(); // A Slidebar is open, close it. - }); - - // Slidebar Close via Link - $('.sb-slidebar a').not('.sb-disable-close').on('touchend click', function(e) { - e.preventDefault(); // Stop click events taking place after touchend and prevent default link behaviour. - close( $(this).attr('href') ); // Call closing method and pass link. - }); - - }; // End slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.7.1/slidebars.min.css b/distribution/0.7.1/slidebars.min.css deleted file mode 100644 index 4a9bfb2..0000000 --- a/distribution/0.7.1/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.7.1 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://opensource.org/licenses/MIT */ -html,body,#sb-site,.sb-slidebar{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{width:100%;overflow-x:hidden}html{height:100%}body{min-height:100%}#sb-site{width:100%;min-height:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{width:35%;height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;visibility:hidden;background-color:#222}html.sb-android .sb-slidebar{height:auto;position:absolute}.sb-left{left:0}.sb-right{right:0}html.sb-active-left .sb-left{visibility:visible}html.sb-active-right .sb-right{visibility:visible}@media(max-width:480px){.sb-slidebar{width:70%}}@media(min-width:481px) and (max-width:991px){.sb-slidebar{width:50%}}@media(min-width:992px){.sb-slidebar{width:35%}}@media(min-width:1200px){.sb-slidebar{width:20%}}html.sb-anim-type-translate .sb-slide,html.sb-anim-type-side .sb-slide{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left;-webkit-backface-visibility:hidden} \ No newline at end of file diff --git a/distribution/0.7.1/slidebars.min.js b/distribution/0.7.1/slidebars.min.js deleted file mode 100644 index d464059..0000000 --- a/distribution/0.7.1/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.7.1 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://opensource.org/licenses/MIT -;(function(a){a.slidebars=function(b){var s=a.extend({siteClose:true},b);var q=document.createElement("div").style,o=false,i=false;if(q.MozTransition===""||q.WebkitTransition===""||q.OTransition===""||q.transition===""){o=true}if(q.MozTransform===""||q.WebkitTransform===""||q.OTransform===""||q.transform===""){i=true}var n=navigator.userAgent,u=false;if(n.match(/Android/)){u=parseFloat(n.slice(n.indexOf("Android")+8));if(u<3){a("html").addClass("sb-android")}}this.init=true;if(!a("#sb-site").length){a("body").children().wrapAll('
')}var m=a("#sb-site");if(!m.parent().is("body")){m.appendTo("body")}m.addClass("sb-slide");if(a(".sb-left").length){var d=a(".sb-left"),e=false;if(!d.parent().is("body")){d.appendTo("body")}}if(a(".sb-right").length){var f=a(".sb-right"),g=false;if(!f.parent().is("body")){f.appendTo("body")}}function p(){var v=a("html").css("height");m.css({"min-height":v});if(u&&u<3){a(".sb-slidebar").css({"min-height":v})}}p();var r,k=a(".sb-slide");if(o&&i){r="translate";if(u&&u<4.4){r="side"}}else{r="jQuery"}if(s.animType){r=s.animType}a("html").addClass("sb-anim-type-"+r);var c=function(v,y,x){if(r==="translate"){v.css({transform:"translate("+y+")"})}else{if(r==="side"){v.css(x,y)}else{if(r==="jQuery"){var w={};w[x]=y;v.stop().animate(w,400)}}}};function h(v){if(v==="left"&&d&&g||v==="right"&&f&&e){j();setTimeout(w,400)}else{w()}function w(){if(v==="left"&&d){e=true;var x=d.css("width");a("html").addClass("sb-active sb-active-left");c(k,x,"left")}else{if(v==="right"&&f){g=true;var y=f.css("width");a("html").addClass("sb-active sb-active-right");c(k,"-"+y,"left")}}if(s.siteClose&&(v==="left"&&e||v==="right"&&g)){m.off("touchend click");setTimeout(function(){m.one("touchend click",function(z){z.preventDefault();j()})},400)}}}function j(v){if(e||g){e=false;g=false;m.off("touchend click");c(k,"0px","left");setTimeout(function(){a("html").removeClass("sb-active sb-active-left sb-active-right");if(v){window.location=v}},400)}}function l(v){if(v=="left"&&d){if(e){j()}else{if(!e){h("left")}}}else{if(v==="right"&&f){if(g){j()}else{if(!g){h("right")}}}}}this.open=h;this.close=j;this.toggle=l;function t(){p();if(e){h("left")}else{if(g){h("right")}}}a(window).resize(t);a(".sb-toggle-left").on("touchend click",function(v){v.preventDefault();l("left")});a(".sb-toggle-right").on("touchend click",function(v){v.preventDefault();l("right")});a(".sb-open-left").on("touchend click",function(v){v.preventDefault();if(!e){h("left")}});a(".sb-open-right").on("touchend click",function(v){v.preventDefault();if(!g){h("right")}});a(".sb-close").on("touchend click",function(v){v.preventDefault();if(e||g){j()}});a(".sb-slidebar a").not(".sb-disable-close").on("touchend click",function(v){v.preventDefault();j(a(this).attr("href"))})}})(jQuery); \ No newline at end of file diff --git a/distribution/0.7/slidebars.css b/distribution/0.7/slidebars.css deleted file mode 100644 index 1159697..0000000 --- a/distribution/0.7/slidebars.css +++ /dev/null @@ -1,121 +0,0 @@ -/* ----------------------------------- - * Slidebars - * Version 0.7 - * http://plugins.adchsm.me/slidebars/ - * - * Written by Adam Smith - * http://www.adchsm.me/ - * - * Released under MIT License - * http://opensource.org/licenses/MIT - * - * ------------------- - * Slidebars CSS Index - * - * 001 - Box Model, Html & Body - * 002 - Site - * 003 - Slidebars - * 004 - Animation - * - * ---------------------------- - * 001 - Box Model, Html & Body - */ - -html, body, #sb-site, .sb-slidebar { - margin: 0; - padding: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -html, body { - width: 100%; - overflow-x: hidden; -} - -html { - height: 100%; -} - -body { - min-height: 100%; -} - -/* ---------- - * 002 - Site - */ - -#sb-site { - width: 100%; - min-height: 100%; /* Initially set here but accurate height is set by slidebars.js */ - position: relative; - z-index: 1; /* Site sits above Slidebars */ - box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0); /* Fixes some translation issues. */ - background-color: #ffffff; /* Default background colour, overwrite this with your own css. */ -} - -/* --------------- - * 003 - Slidebars - */ - -.sb-slidebar { - width: 35%; /* Slidebar width for older browsers that don't support media queries. */ - height: 100%; - overflow-y: auto; /* Enable vertical scrolling on Slidebars when needed. */ - position: fixed; - top: 0; - z-index: 0; /* Slidebars sit behind sb-site. */ - visibility: hidden; /* Initially hide the Slidebars. */ - background-color: #222222; /* Default Slidebars background colour, overwrite this with your own css. */ -} - -.sb-left { - left: 0; -} - -.sb-right { - right: 0; -} - -.sb-visible { - visibility: visible; -} - -/* Media queries to set Slidebar widths. */ -@media (max-width: 480px) { - .sb-slidebar { - width: 70%; /* Slidebar width on extra small screens. */ - } -} - -@media (min-width: 481px) and (max-width: 991px) { - .sb-slidebar { - width: 50%; /* Slidebar width on small screens. */ - } -} - -@media (min-width: 992px) { - .sb-slidebar { - width: 35%; /* Slidebar width on medium screens. */ - } -} - -@media (min-width: 1200px) { - .sb-slidebar { - width: 20%; /* Slidebar width on large screens. */ - } -} - -/* --------------- - * 004 - Animation - */ - -.sb-slide { - -webkit-transition: -webkit-transform 400ms ease; - -moz-transition: -moz-transform 400ms ease; - -o-transition: -o-transform 400ms ease; - transition: transform 400ms ease; - -webkit-transition-property: -webkit-transform, left; /* Add 'left' for Android < 4.4 */ - -webkit-backface-visibility: hidden; /* Prevents flickering. */ -} \ No newline at end of file diff --git a/distribution/0.7/slidebars.js b/distribution/0.7/slidebars.js deleted file mode 100644 index 6352963..0000000 --- a/distribution/0.7/slidebars.js +++ /dev/null @@ -1,358 +0,0 @@ -// ----------------------------------- -// Slidebars -// Version 0.7 -// http://plugins.adchsm.me/slidebars/ -// -// Written by Adam Smith -// http://www.adchsm.me/ -// -// Released under MIT License -// http://opensource.org/licenses/MIT -// -// --------------------- -// Index of Slidebars.js -// -// 001 - Feature Detection -// 002 - User Agents -// 003 - Initialisation -// 004 - Animation -// 005 - Operations -// 006 - API -// 007 - Window Resizes -// 008 - User Input - -;(function($) { - - $.slidebars = function() { - - // ----------------------- - // 001 - Feature Detection - - var test = document.createElement('div').style, - supportTransition = false, - supportTransform = false; - - // CSS Transitions - if (test.MozTransition === '' || test.WebkitTransition === '' || test.OTransition === '' || test.transition === '') { - supportTransition = true; - } - - // CSS Transforms - if (test.MozTransform === '' || test.WebkitTransform === '' || test.OTransform === '' || test.transform === '') { - supportTransform = true; - } - - // ----------------- - // 002 - User Agents - - // Get User Agent String - var ua = navigator.userAgent, - android = false; - - // Detect Android - if (ua.match(/Android/)) {// The user agent is Android. - android = parseFloat(ua.slice(ua.indexOf('Android')+8)); // Get version of Android. - } - - // -------------------- - // 003 - Initialisation - - this.init = true; // User check, returns true if Slidebars has been initiated. - - // Site Container - if (!$('#sb-site').length) { // Check if user has wrapped their content with an id of sb-site. - // .sb-site doesn't exist, create it. - $('body').children().wrapAll('
'); - } - var $site = $('#sb-site'); // Cache the selector. - if (!$site.parent().is('body')) { // Check its location and move if necessary. - $site.appendTo('body'); - } - - $site.addClass('sb-slide'); // Add animation class. - - // Left Slidebar - if ($('.sb-left').length) { // Check the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - if (!$left.parent().is('body')) { // Check its location and move if necessary. - $left.appendTo('body'); - } - } - - // Right Slidebar - if ($('.sb-right').length) { // Check the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - if (!$right.parent().is('body')) { // Check its location and move if necessary. - $right.appendTo('body'); - } - } - - // Set Minimum Height - function setMinHeights() { - var htmlHeight = $('html').css('height'); - $site.css({ - 'min-height': htmlHeight - }); - if (android && android < 3) { - $('.sb-slidebar').css({ - 'min-height': htmlHeight, - 'height': 'auto', - 'position': 'absolute' - }); - } - } - setMinHeights(); - - // --------------- - // 004 - Animation - - var animation, // Animation type. - $slide = $('.sb-slide'); // Cache all elements to animate. - - // Set animation type. - if (supportTransition && supportTransform) { // CSS Transitions - if (android && android < 4.4) { - animation = 'left'; - } else { - animation = 'translate'; - } - } else { - animation = 'jquery'; // Browsers that don't support css transitions and transitions or Android for issues with translating elements with positioned fixed. - } - - // ---------------- - // 003 - Operations - - // Open a Slidebar - function open(side) { - - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { - // It's open, close it, then continue. - close(); - setTimeout(openSlidebar, 400); - } else { - // Its not open, continue. - openSlidebar(); - } - - function openSlidebar() { - if (side === 'left' && $left) { // Open left Slidebar and make sure the left Slidebar is in use. - - leftActive = true; // Set active variables. - var leftWidth = $left.css('width'); // Get the width of the left Slidebar. - - $left.addClass('sb-visible'); // Make the slidebar visible. - - // Animation - if (animation == 'translate') { - $slide.css({ - '-webkit-transform': 'translate(' + leftWidth + ')', - '-moz-transform': 'translate(' + leftWidth + ')', - '-o-transform': 'translate(' + leftWidth + ')', - 'transform': 'translate(' + leftWidth + ')' - }); - } else if (animation == 'left') { - $slide.css({ - 'left': leftWidth - }); - } else if (animation == 'jquery') { - $slide.animate({ - left: leftWidth - }, 400); - } - - setTimeout(function() { - $('html').addClass('sb-active sb-active-left'); // Add active classes. - }, 400); - - } else if (side === 'right' && $right) { // Open right Slidebar and make sure the right Slidebar is in use. - - rightActive = true; // Set active variables. - var rightWidth = $right.css('width'); // Get the width of the right Slidebar. - - $right.addClass('sb-visible'); // Make the slidebar visible. - - // Animation - if (animation == 'translate') { - $slide.css({ - '-webkit-transform': 'translate(-' + rightWidth + ')', - '-moz-transform': 'translate(-' + rightWidth + ')', - '-o-transform': 'translate(-' + rightWidth + ')', - 'transform': 'translate(-' + rightWidth + ')' - }); - } else if (animation == 'left') { - $slide.css({ - 'left': '-' + rightWidth - }); - } else if (animation == 'jquery') { - $slide.animate({ - left: '-' + rightWidth - }, 400); - } - - setTimeout(function() { - $('html').addClass('sb-active sb-active-right'); // Add active classes. - }, 400); - - } // End if side = left/right. - - // Enable closing by sb-site. - if (side === 'left' && leftActive || side === 'right' && rightActive) { // If a Slidebar was opened. - $site.off('touchend click'); // Turn off click close incase this was called by a window resize. - setTimeout(function() { - $site.one('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - close(); - }); - }, 400); - } - } // End continue(); - - } - - // Close either Slidebar - function close(link) { - - if (leftActive || rightActive) { // If a Slidebar is open. - - leftActive = false; // Set active variable. - rightActive = false; // Set active variable. - - $site.off('touchend click'); // Turn off closing by .sb-site. - - // Animation - if (animation == 'translate') { - $slide.css({ - '-webkit-transform': 'translate(0px)', - '-moz-transform': 'translate(0px)', - '-o-transform': 'translate(0px)', - 'transform': 'translate(0px)' - }); - } else if (animation == 'left') { - $slide.css({ - 'left': '0px' - }); - } else if (animation == 'jquery') { - $slide.animate({ - left: '0px' - }, 400); - } - - setTimeout(function() { // Wait for closing animation to finish. - // Hide the Slidebars. - if ($left) { - $left.removeClass('sb-visible'); - } - - if ($right) { - $right.removeClass('sb-visible'); - } - - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - - if (link) { // If a link has been passed to the function, go to it. - window.location = link; - } - }, 400); - - } - - } - - // Toggle either Slidebar - function toggle(side) { - - if (side == 'left' && $left) { // If left Slidebar is called and in use. - if (leftActive) { - // Slidebar is open, close it. - close(); - } else if (!leftActive) { - // Slidebar is closed, open it. - open('left'); - } - } else if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (rightActive) { - // Slidebar is open, close it. - close(); - } else if (!rightActive) { - // Slidebar is closed, open it. - open('right'); - } - } - - } - - // --------- - // 004 - API - - this.open = open; // Maps user variable name to the open method. - this.close = close; // Maps user variable name to the close method. - this.toggle = toggle; // Maps user variable name to the toggle method. - - // -------------------- - // 005 - Window Resizes - - function resize() { - setMinHeights(); // Reset the minimum height of the site. - if (leftActive) { // Left Slidebar is open whilst the window is resized. - open('left'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } else if (rightActive) { // Right Slidebar is open whilst the window is resized. - open('right'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } - } - $(window).resize(resize); - - // ---------------- - // 006 - User Input - - // Slidebar Toggle Left - $('.sb-toggle-left').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - toggle('left'); - }); - - // Slidebar Toggle Right - $('.sb-toggle-right').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - toggle('right'); - }); - - // Slidebar Left Open - $('.sb-open-left').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - if (!leftActive) { - // Slidebar is closed, open it. - open('left'); - } - }); - - // Slidebar Right Open - $('.sb-open-right').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - if (!rightActive) { - // Slidebar is closed, open it. - open('right'); - } - }); - - // Slidebar Close - $('.sb-close').on('touchend click', function(e) { - e.preventDefault(); // Stops click events taking place after touchend. - if (leftActive || rightActive) { - // A Slidebar is open, close it. - close(); - } - }); - - // Slidebar Close via Link - $('.sb-slidebar a').on('touchend click', function(e) { - e.preventDefault(); // Stop click events taking place after touchend and prevent default link behaviour. - close( $(this).attr('href') ); // Call closing method and pass link. - }); - - }; // End slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.7/slidebars.min.css b/distribution/0.7/slidebars.min.css deleted file mode 100644 index 7d171ca..0000000 --- a/distribution/0.7/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.7 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://opensource.org/licenses/MIT */ -html,body,#sb-site,.sb-slidebar{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{width:100%;overflow-x:hidden}html{height:100%}body{min-height:100%}#sb-site{width:100%;min-height:100%;position:relative;z-index:1;box-shadow:0 0 1px 1px rgba(0,0,0,0);background-color:#fff}.sb-slidebar{width:35%;height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;visibility:hidden;background-color:#222}.sb-left{left:0}.sb-right{right:0}.sb-visible{visibility:visible}@media(max-width:480px){.sb-slidebar{width:70%}}@media(min-width:481px) and (max-width:991px){.sb-slidebar{width:50%}}@media(min-width:992px){.sb-slidebar{width:35%}}@media(min-width:1200px){.sb-slidebar{width:20%}}.sb-slide{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left;-webkit-backface-visibility:hidden} \ No newline at end of file diff --git a/distribution/0.7/slidebars.min.js b/distribution/0.7/slidebars.min.js deleted file mode 100644 index 2657999..0000000 --- a/distribution/0.7/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.7 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://opensource.org/licenses/MIT -;(function(b){b.slidebars=function(){function s(){var a=b("html").css("height");m.css({"min-height":a});q&&3>q&&b(".sb-slidebar").css({"min-height":a,height:"auto",position:"absolute"})}function n(a){function c(){if("left"===a&&h){e=!0;var d=h.css("width");h.addClass("sb-visible");"translate"==f?k.css({"-webkit-transform":"translate("+d+")","-moz-transform":"translate("+d+")","-o-transform":"translate("+d+")",transform:"translate("+d+")"}):"left"==f?k.css({left:d}):"jquery"==f&&k.animate({left:d}, 400);setTimeout(function(){b("html").addClass("sb-active sb-active-left")},400)}else"right"===a&&l&&(g=!0,d=l.css("width"),l.addClass("sb-visible"),"translate"==f?k.css({"-webkit-transform":"translate(-"+d+")","-moz-transform":"translate(-"+d+")","-o-transform":"translate(-"+d+")",transform:"translate(-"+d+")"}):"left"==f?k.css({left:"-"+d}):"jquery"==f&&k.animate({left:"-"+d},400),setTimeout(function(){b("html").addClass("sb-active sb-active-right")},400));if("left"===a&&e||"right"===a&&g)m.off("touchend click"), setTimeout(function(){m.one("touchend click",function(a){a.preventDefault();p()})},400)}"left"===a&&h&&g||"right"===a&&l&&e?(p(),setTimeout(c,400)):c()}function p(a){if(e||g)g=e=!1,m.off("touchend click"),"translate"==f?k.css({"-webkit-transform":"translate(0px)","-moz-transform":"translate(0px)","-o-transform":"translate(0px)",transform:"translate(0px)"}):"left"==f?k.css({left:"0px"}):"jquery"==f&&k.animate({left:"0px"},400),setTimeout(function(){h&&h.removeClass("sb-visible");l&&l.removeClass("sb-visible"); b("html").removeClass("sb-active sb-active-left sb-active-right");a&&(window.location=a)},400)}function r(a){"left"==a&&h?e?p():e||n("left"):"right"===a&&l&&(g?p():g||n("right"))}var c=document.createElement("div").style,t=!1,u=!1;if(""===c.MozTransition||""===c.WebkitTransition||""===c.OTransition||""===c.transition)t=!0;if(""===c.MozTransform||""===c.WebkitTransform||""===c.OTransform||""===c.transform)u=!0;var c=navigator.userAgent,q=!1;c.match(/Android/)&&(q=parseFloat(c.slice(c.indexOf("Android")+ 8)));this.init=!0;b("#sb-site").length||b("body").children().wrapAll('
');var m=b("#sb-site");m.parent().is("body")||m.appendTo("body");m.addClass("sb-slide");if(b(".sb-left").length){var h=b(".sb-left"),e=!1;h.parent().is("body")||h.appendTo("body")}if(b(".sb-right").length){var l=b(".sb-right"),g=!1;l.parent().is("body")||l.appendTo("body")}s();var f,k=b(".sb-slide");f=t&&u?q&&4.4>q?"left":"translate":"jquery";this.open=n;this.close=p;this.toggle=r;b(window).resize(function(){s(); e?n("left"):g&&n("right")});b(".sb-toggle-left").on("touchend click",function(a){a.preventDefault();r("left")});b(".sb-toggle-right").on("touchend click",function(a){a.preventDefault();r("right")});b(".sb-open-left").on("touchend click",function(a){a.preventDefault();e||n("left")});b(".sb-open-right").on("touchend click",function(a){a.preventDefault();g||n("right")});b(".sb-close").on("touchend click",function(a){a.preventDefault();(e||g)&&p()});b(".sb-slidebar a").on("touchend click",function(a){a.preventDefault(); p(b(this).attr("href"))})}})(jQuery); \ No newline at end of file diff --git a/distribution/0.8.1/slidebars.css b/distribution/0.8.1/slidebars.css deleted file mode 100644 index 0cb86ce..0000000 --- a/distribution/0.8.1/slidebars.css +++ /dev/null @@ -1,139 +0,0 @@ -/* ----------------------------------- - * Slidebars - * Version 0.8.1 - * http://plugins.adchsm.me/slidebars/ - * - * Written by Adam Smith - * http://www.adchsm.me/ - * - * Released under MIT License - * http://plugins.adchsm.me/slidebars/license.txt - * - * ------------------- - * Slidebars CSS Index - * - * 001 - Box Model, Html & Body - * 002 - Site - * 003 - Slidebars - * 004 - Animation - * - * ---------------------------- - * 001 - Box Model, Html & Body - */ - -html, body, #sb-site, .sb-slidebar { - margin: 0; - padding: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -html, body { - width: 100%; - overflow-x: hidden; /* Stops horizontal scrolling. */ -} - -html { - min-height: 100%; -} - -body { - height: 100%; -} - -/* ---------- - * 002 - Site - */ - -#sb-site { - width: 100%; - min-height: 100%; /* Initially set here but accurate height is set by slidebars.js */ - position: relative; - z-index: 1; /* Site sits above Slidebars */ - background-color: #ffffff; /* Default background colour, overwrite this with your own css. */ -} - -/* --------------- - * 003 - Slidebars - */ - -.sb-slidebar { - height: 100%; - overflow-y: auto; /* Enable vertical scrolling on Slidebars when needed. */ - position: fixed; - top: 0; - z-index: 0; /* Slidebars sit behind sb-site. */ - visibility: hidden; /* Initially hide the Slidebars. */ - background-color: #222222; /* Default Slidebars background colour, overwrite this with your own css. */ -} - -.sb-static { /* Makes Slidebars scroll naturally with the site, and unfixes them for Android Browser 2.X. */ - position: absolute; -} - -.sb-left { - left: 0; /* Sets Slidebar to the left. */ -} - -.sb-right { - right: 0; /* Sets Slidebar to the right. */ -} - -html.sb-active-left .sb-left, -html.sb-active-right .sb-right { - visibility: visible; /* Makes Slidebars visibile when open. */ -} - -/* Slidebar Widths */ - -.sb-slidebar { - width: 30%; /* Browsers that don't support media queries. */ -} - -.sb-width-custom { - /* To set a custom width, add this class to your Slidebar and pass a px or % value as a data attribute 'data-sb-width'. */ -} - -@media (max-width: 480px) { - .sb-slidebar { - width: 70%; /* Slidebar width on extra small screens. */ - } -} - -@media (min-width: 481px) { - .sb-slidebar { - width: 55%; /* Slidebar width on small screens. */ - } -} - -@media (min-width: 768px) { - .sb-slidebar { - width: 40%; /* Slidebar width on small screens. */ - } -} - -@media (min-width: 992px) { - .sb-slidebar { - width: 30%; /* Slidebar width on medium screens. */ - } -} - -@media (min-width: 1200px) { - .sb-slidebar { - width: 20%; /* Slidebar width on large screens. */ - } -} - -/* --------------- - * 004 - Animation - */ - -html.sb-anim-type-translate .sb-slide, html.sb-anim-type-side .sb-slide { - -webkit-transition: -webkit-transform 400ms ease; - -moz-transition: -moz-transform 400ms ease; - -o-transition: -o-transform 400ms ease; - transition: transform 400ms ease; - -webkit-transition-property: -webkit-transform, left; /* Add 'left' for Android < 4.4 */ - -webkit-backface-visibility: hidden; /* Prevents flickering. */ -} \ No newline at end of file diff --git a/distribution/0.8.1/slidebars.js b/distribution/0.8.1/slidebars.js deleted file mode 100644 index cb63f19..0000000 --- a/distribution/0.8.1/slidebars.js +++ /dev/null @@ -1,284 +0,0 @@ -// ----------------------------------- -// Slidebars -// Version 0.8.1 -// http://plugins.adchsm.me/slidebars/ -// -// Written by Adam Smith -// http://www.adchsm.me/ -// -// Released under MIT License -// http://plugins.adchsm.me/slidebars/license.txt -// -// --------------------- -// Index of Slidebars.js -// -// 001 - Default Settings -// 002 - Feature Detection -// 003 - User Agents -// 004 - Setup -// 005 - Animation -// 006 - Operations -// 007 - API -// 008 - Window Resizes -// 009 - User Input - -;(function($) { - - $.slidebars = function(options) { - - // ---------------------- - // 001 - Default Settings - - var settings = $.extend({ - siteClose: true, // true or false - Enable closing of Slidebars by clicking on #sb-site. - disableOver: false, // integer or false - Hide Slidebars over a specific width. - hideControlClasses: false // true or false - Hide controls at same width as disableOver. - }, options); - - // ----------------------- - // 002 - Feature Detection - - var test = document.createElement('div').style, // Create element to test on. - supportTransition = false, // Variable for testing transitions. - supportTransform = false; // variable for testing transforms. - - // Test for CSS Transitions - if (test.MozTransition === '' || test.WebkitTransition === '' || test.OTransition === '' || test.transition === '') supportTransition = true; - - // Test for CSS Transforms - if (test.MozTransform === '' || test.WebkitTransform === '' || test.OTransform === '' || test.transform === '') supportTransform = true; - - // ----------------- - // 003 - User Agents - - var ua = navigator.userAgent, // Get user agent string. - android = false; // Variable for storing android version. - - if (ua.match(/Android/)) { // Detect for Android in user agent string. - android = parseFloat(ua.slice(ua.indexOf('Android')+8)); // Get version of Android. - if (android < 3) $('html').addClass('sb-android'); // Add 'sb-android' helper class for unfixing elements. - } - - // ----------- - // 004 - Setup - - // Site Container - if (!$('#sb-site').length) $('body').children().wrapAll('
'); // Check if content is wrapped with sb-site, wrap if it isn't. - var $site = $('#sb-site'); // Cache the selector. - if (!$site.parent().is('body')) $site.appendTo('body'); // Check its location and move if necessary. - $site.addClass('sb-slide'); // Add animation class. - - // Left Slidebar - if ($('.sb-left').length) { // Check if the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - if (!$left.parent().is('body')) $left.appendTo('body'); // Check its location and move if necessary. - if (android && android < 3) $left.addClass('sb-static'); // Add static class for older versions of Android. - if ($left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check if the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - if (!$right.parent().is('body')) $right.appendTo('body'); // Check its location and move if necessary. - if (android && android < 3) $right.addClass('sb-static'); // Add static class for older versions of Android. - if ($right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. - } - - // Set Minimum Heights - function setMinHeights() { - var minHeight = $('html').css('height'); // Get minimum height of the page. - $site.css('minHeight', minHeight); // Set minimum height to the site. - if ($left && $left.hasClass('sb-static')) $left.css('minHeight', minHeight); // Set minimum height to the left Slidebar. - if ($right && $right.hasClass('sb-static')) $right.css('minHeight', minHeight); // Set minimum height to the right Slidebar. - } - setMinHeights(); // Set them - - // Control Classes - var $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'); - - // Initialise - function initialise() { - var windowWidth = $(window).width(); // Get the window width. - if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. - this.init = true; // User check, returns true if Slidebars has been initiated. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.show(); - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. - this.init = false; // User check, returns true if Slidebars has been initiated. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.hide(); // Hide controls - if (leftActive || rightActive) close(); // Close Slidebars if open. - } - } - initialise(); - - // --------------- - // 005 - Animation - - var animation, // Animation type. - $slide = $('.sb-slide'); // Cache all elements to animate. - - // Set Animation Type - if (supportTransition && supportTransform) { // Browser supports CSS Transitions - animation = 'translate'; // Translate for browser that support transform and tranisions. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - - $('html').addClass('sb-anim-type-' + animation); // Add animation type class. - - // Animate Mixin - function animate (selector, amount, side) { - if (animation === 'translate') { - selector.css({ - 'transform': 'translate(' + amount + ')' - }); - } else if (animation === 'side') { - selector.css(side, amount); - } else if (animation === 'jQuery') { - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); - } - } - - // ---------------- - // 006 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (this.init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - var leftWidth = $left.css('width'); // Get the width of the left Slidebar. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - animate($slide, leftWidth, 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (this.init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - var rightWidth = $right.css('width'); // Get the width of the right Slidebar. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - animate($slide, '-' + rightWidth, 'left'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. - } - } - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - leftActive = false; // Set active variable. - rightActive = false; // Set active variable. - animate($slide, '0px', 'left'); // Animation - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if (link) window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (leftActive) { - close(); // Slidebar is open, close it. - } else if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } - } else if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (rightActive) { - close(); // Slidebar is open, close it. - } else if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } - } - } - - // --------- - // 007 - API - - this.open = open; // Maps user variable name to the open method. - this.close = close; // Maps user variable name to the close method. - this.toggle = toggle; // Maps user variable name to the toggle method. - - // -------------------- - // 008 - Window Resizes - - function resize() { - setMinHeights(); // Reset the minimum heights. - initialise(); // Check new screen sizes to see if Slidebars should still operate. - if (leftActive) { // Left Slidebar is open whilst the window is resized. - open('left'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } else if (rightActive) { // Right Slidebar is open whilst the window is resized. - open('right'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } - } - $(window).resize(resize); - - // ---------------- - // 009 - User Input - - function input(event) { // Stop default behaviour and event bubbling. - event.preventDefault(); - event.stopPropagation(); - } - - // Slidebar Toggle Left - $('.sb-toggle-left').on('touchend click', function(event) { - input(event); - toggle('left'); // Toggle left Slidebar. - }); - - // Slidebar Toggle Right - $('.sb-toggle-right').on('touchend click', function(event) { - input(event); - toggle('right'); // Toggle right Slidebar. - }); - - // Slidebar Left Open - $('.sb-open-left').on('touchend click', function(event) { - input(event); - if (!leftActive) open('left'); // Slidebar is closed, open it. - }); - - // Slidebar Right Open - $('.sb-open-right').on('touchend click', function(event) { - input(event); - if (!rightActive) open('right'); // Slidebar is closed, open it. - }); - - // Slidebar Close - $('.sb-close').on('touchend click', function(event) { - input(event); - if (leftActive || rightActive) close(); // A Slidebar is open, close it. - }); - - // Slidebar Close via Link - $('.sb-slidebar a').not('.sb-disable-close').on('click', function(event) { - if (leftActive || rightActive) { // Only proceed is a Slidebar is active. - input(event); - close( $(this).attr('href') ); // Call closing method and pass link. - } - }); - - // Slidebar Close via Site - $site.on('touchend click', function(event) { - if (leftActive || rightActive) { // Only proceed if the left or the right Slidebar is active. - input(event); // If active, stop the click bubbling. - close(); // Close the Slidebar. - } - }); - - }; // End slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.8.1/slidebars.min.css b/distribution/0.8.1/slidebars.min.css deleted file mode 100644 index 79928a8..0000000 --- a/distribution/0.8.1/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.8.1 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt */ -html,body,#sb-site,.sb-slidebar{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{width:100%;overflow-x:hidden}html{min-height:100%}body{height:100%}#sb-site{width:100%;min-height:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{height:100%;width:30%;overflow-y:auto;position:fixed;top:0;z-index:0;visibility:hidden;background-color:#222}.sb-static{position:absolute}.sb-left{left:0}.sb-right{right:0}html.sb-active-left .sb-left,html.sb-active-right .sb-right{visibility:visible}@media(max-width:480px){.sb-slidebar{width:70%}}@media(min-width:481px){.sb-slidebar{width:55%}}@media(min-width:768px){.sb-slidebar{width:40%}}@media(min-width:992px){.sb-slidebar{width:30%}}@media(min-width:1200px){.sb-slidebar{width:20%}}html.sb-anim-type-translate .sb-slide,html.sb-anim-type-side .sb-slide{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left;-webkit-backface-visibility:hidden} \ No newline at end of file diff --git a/distribution/0.8.1/slidebars.min.js b/distribution/0.8.1/slidebars.min.js deleted file mode 100644 index 76d9c93..0000000 --- a/distribution/0.8.1/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.8.1 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt -;(function(a){a.slidebars=function(b){var v=a.extend({siteClose:true,disableOver:false,hideControlClasses:false},b);var s=document.createElement("div").style,q=false,j=false;if(s.MozTransition===""||s.WebkitTransition===""||s.OTransition===""||s.transition===""){q=true}if(s.MozTransform===""||s.WebkitTransform===""||s.OTransform===""||s.transform===""){j=true}var p=navigator.userAgent,x=false;if(p.match(/Android/)){x=parseFloat(p.slice(p.indexOf("Android")+8));if(x<3){a("html").addClass("sb-android")}}if(!a("#sb-site").length){a("body").children().wrapAll('
')}var o=a("#sb-site");if(!o.parent().is("body")){o.appendTo("body")}o.addClass("sb-slide");if(a(".sb-left").length){var d=a(".sb-left"),e=false;if(!d.parent().is("body")){d.appendTo("body")}if(x&&x<3){d.addClass("sb-static")}if(d.hasClass("sb-width-custom")){d.css("width",d.attr("data-sb-width"))}}if(a(".sb-right").length){var g=a(".sb-right"),i=false;if(!g.parent().is("body")){g.appendTo("body")}if(x&&x<3){g.addClass("sb-static")}if(g.hasClass("sb-width-custom")){g.css("width",g.attr("data-sb-width"))}}function r(){var y=a("html").css("height");o.css("minHeight",y);if(d&&d.hasClass("sb-static")){d.css("minHeight",y)}if(g&&g.hasClass("sb-static")){g.css("minHeight",y)}}r();var u=a(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close");function n(){var y=a(window).width();if(!v.disableOver||(typeof v.disableOver==="number"&&v.disableOver>=y)){this.init=true;a("html").addClass("sb-init");if(v.hideControlClasses){u.show()}}else{if(typeof v.disableOver==="number"&&v.disableOver'); // Check if content is wrapped with sb-site, wrap if it isn't. - var $site = $('#sb-site'); // Cache the selector. - if (!$site.parent().is('body')) $site.appendTo('body'); // Check its location and move if necessary. - $site.addClass('sb-slide'); // Add animation class. - - // Left Slidebar - if ($('.sb-left').length) { // Check if the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - if (!$left.parent().is('body')) $left.appendTo('body'); // Check its location and move if necessary. - if (android && android < 3) $left.addClass('sb-static'); // Add static class for older versions of Android. - if ($left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check if the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - if (!$right.parent().is('body')) $right.appendTo('body'); // Check its location and move if necessary. - if (android && android < 3) $right.addClass('sb-static'); // Add static class for older versions of Android. - if ($right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. - } - - // Set Minimum Heights - function setMinHeights() { - $site.css('minHeight', ''); // Remove any min-height set. - if ($left) $left.css('minHeight', ''); // Remove any min-height set. - if ($right) $right.css('minHeight', ''); // Remove any min-height set. - var minHeight = $('html').css('height'); // Get minimum height of the page. - $site.css('minHeight', minHeight); // Set minimum height to the site. - if ($left && $left.hasClass('sb-static')) $left.css('minHeight', minHeight); // Set minimum height to the left Slidebar. - if ($right && $right.hasClass('sb-static')) $right.css('minHeight', minHeight); // Set minimum height to the right Slidebar. - } - setMinHeights(); // Set them. - - // Control Classes - var $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'); - - // Initialise - function initialise() { - var windowWidth = $(window).width(); // Get the window width. - if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. - this.init = true; // User check, returns true if Slidebars has been initiated. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.show(); - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. - this.init = false; // User check, returns true if Slidebars has been initiated. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.hide(); // Hide controls - if (leftActive || rightActive) close(); // Close Slidebars if open. - } - } - initialise(); - - // --------------- - // 005 - Animation - - var animation, // Animation type. - $slide = $('.sb-slide'); // Cache all elements to animate. - - // Set Animation Type - if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. - animation = 'translate'; // Translate for browsers that support it. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - - $('html').addClass('sb-anim-type-' + animation); // Add animation type class. - - // Animate Mixin - function animate (selector, amount, side) { - if (animation === 'translate') { - selector.css({ - 'transform': 'translate(' + amount + ')' - }); - } else if (animation === 'side') { - selector.css(side, amount); - } else if (animation === 'jQuery') { - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); - } - } - - // ---------------- - // 006 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (this.init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - var leftWidth = $left.css('width'); // Get the width of the left Slidebar. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - animate($slide, leftWidth, 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (this.init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - var rightWidth = $right.css('width'); // Get the width of the right Slidebar. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - animate($slide, '-' + rightWidth, 'left'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. - } - } - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - leftActive = false; // Set active variable. - rightActive = false; // Set active variable. - animate($slide, '0px', 'left'); // Animation - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if (link) window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (leftActive) { - close(); // Slidebar is open, close it. - } else if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } - } else if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (rightActive) { - close(); // Slidebar is open, close it. - } else if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } - } - } - - // --------- - // 007 - API - - this.open = open; // Maps user variable name to the open method. - this.close = close; // Maps user variable name to the close method. - this.toggle = toggle; // Maps user variable name to the toggle method. - - // -------------------- - // 008 - Window Resizes - - function resize() { - setMinHeights(); // Reset the minimum heights. - initialise(); // Check new screen sizes to see if Slidebars should still operate. - if (leftActive) { // Left Slidebar is open whilst the window is resized. - open('left'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } else if (rightActive) { // Right Slidebar is open whilst the window is resized. - open('right'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } - } - $(window).resize(resize); - - // ---------------- - // 009 - User Input - - function eventHandler(event, selector) { - event.stopPropagation(); // Stop event bubbling. - event.preventDefault(); // Prevent default behaviour - if (event.type === 'touchend') selector.off('click'); // If event type was touch turn off clicks to prevent phantom clicks. - } - - // Toggle Left Slidebar - $('.sb-toggle-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - if ($left && leftActive !== true) { // If using left Slidebar and its closed. - open('left'); // Its closed, open it. - } else { - close(); // Its open, close it. - } - }); - - // Toggle Right Slidebar - $('.sb-toggle-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - if ($right && rightActive !== true) { // If using right Slidebar and its closed. - open('right'); // Its closed, open it. - } else { - close(); // Its open, close it. - } - }); - - // Open Left Slidebar - $('.sb-open-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - if ($left && leftActive !== true) open('left'); // If using left Slidebar and its closed. - }); - - // Open Right Slidebar - $('.sb-open-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - if ($right && rightActive !== true) open('right'); // If using right Slidebar and its closed. - }); - - // Close a Slidebar - $('.sb-close').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - if (leftActive || rightActive) close(); // If left or right Slidebar is open, close it. - }); - - // Close Slidebar via Link - $('.sb-slidebar a').not('.sb-disable-close').on('click', function(event) { - eventHandler(event, $(this)); // Handle the event. - if (leftActive || rightActive) close( $(this).attr('href') ); // If left or right Slidebar is open, close it and pass link. - }); - - // Close Slidebar via Site - $site.on('touchend click', function(event) { - if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. - eventHandler(event, $(this)); // Handle the event. - close(); // Close it. - } - }); - - }; // End slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.8.2/slidebars.min.css b/distribution/0.8.2/slidebars.min.css deleted file mode 100644 index f1a283b..0000000 --- a/distribution/0.8.2/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.8.2 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt */ -html,body,#sb-site,.sb-slidebar{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{width:100%;overflow-x:hidden}html{min-height:100%}body{height:100%}#sb-site{width:100%;min-height:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;visibility:hidden;background-color:#222}.sb-static{position:absolute;height:auto}.sb-left{left:0}.sb-right{right:0}html.sb-active-left .sb-left,html.sb-active-right .sb-right{visibility:visible}.sb-slidebar{width:30%}@media(max-width:480px){.sb-slidebar{width:70%}}@media(min-width:481px){.sb-slidebar{width:55%}}@media(min-width:768px){.sb-slidebar{width:40%}}@media(min-width:992px){.sb-slidebar{width:30%}}@media(min-width:1200px){.sb-slidebar{width:20%}}html.sb-anim-type-translate .sb-slide,html.sb-anim-type-side .sb-slide{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left;-webkit-backface-visibility:hidden} \ No newline at end of file diff --git a/distribution/0.8.2/slidebars.min.js b/distribution/0.8.2/slidebars.min.js deleted file mode 100644 index bc4564d..0000000 --- a/distribution/0.8.2/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.8.2 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt -;(function(a){a.slidebars=function(b){var v=a.extend({siteClose:true,disableOver:false,hideControlClasses:false},b);var s=document.createElement("div").style,q=false,i=false;if(s.MozTransition===""||s.WebkitTransition===""||s.OTransition===""||s.transition===""){q=true}if(s.MozTransform===""||s.WebkitTransform===""||s.OTransform===""||s.transform===""){i=true}var p=navigator.userAgent,x=false;if(p.match(/Android/)){x=parseFloat(p.slice(p.indexOf("Android")+8));if(x<3){a("html").addClass("sb-android")}}if(!a("#sb-site").length){a("body").children().wrapAll('
')}var o=a("#sb-site");if(!o.parent().is("body")){o.appendTo("body")}o.addClass("sb-slide");if(a(".sb-left").length){var d=a(".sb-left"),e=false;if(!d.parent().is("body")){d.appendTo("body")}if(x&&x<3){d.addClass("sb-static")}if(d.hasClass("sb-width-custom")){d.css("width",d.attr("data-sb-width"))}}if(a(".sb-right").length){var f=a(".sb-right"),h=false;if(!f.parent().is("body")){f.appendTo("body")}if(x&&x<3){f.addClass("sb-static")}if(f.hasClass("sb-width-custom")){f.css("width",f.attr("data-sb-width"))}}function r(){o.css("minHeight","");if(d){d.css("minHeight","")}if(f){f.css("minHeight","")}var y=a("html").css("height");o.css("minHeight",y);if(d&&d.hasClass("sb-static")){d.css("minHeight",y)}if(f&&f.hasClass("sb-static")){f.css("minHeight",y)}}r();var u=a(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close");function m(){var y=a(window).width();if(!v.disableOver||(typeof v.disableOver==="number"&&v.disableOver>=y)){this.init=true;a("html").addClass("sb-init");if(v.hideControlClasses){u.show()}}else{if(typeof v.disableOver==="number"&&v.disableOver'); // Check if content is wrapped with sb-site, wrap if it isn't. - var $site = $('#sb-site'); // Cache the selector. - if (!$site.parent().is('body')) $site.appendTo('body'); // Check its location and move if necessary. - $site.addClass('sb-slide'); // Add animation class. - - // Left Slidebar - if ($('.sb-left').length) { // Check if the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - if (!$left.parent().is('body')) $left.appendTo('body'); // Check its location and move if necessary. - if (android && android < 3) $left.addClass('sb-static'); // Add static class for older versions of Android. - if ($left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check if the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - if (!$right.parent().is('body')) $right.appendTo('body'); // Check its location and move if necessary. - if (android && android < 3) $right.addClass('sb-static'); // Add static class for older versions of Android. - if ($right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. - } - - // Set Minimum Heights - function setMinHeights() { - var minHeight = $('html').css('height'); // Get minimum height of the page. - $site.css('minHeight', minHeight); // Set minimum height to the site. - if ($left.hasClass('sb-static')) $left.css('minHeight', minHeight); // Set minimum height to the left Slidebar. - if ($right.hasClass('sb-static')) $right.css('minHeight', minHeight); // Set minimum height to the right Slidebar. - } - setMinHeights(); // Set them - - // Control Classes - var $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'); - - // Initialise - function initialise() { - var windowWidth = $(window).width(); // Get the window width. - if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. - this.init = true; // User check, returns true if Slidebars has been initiated. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.show(); - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. - this.init = false; // User check, returns true if Slidebars has been initiated. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.hide(); // Hide controls - if (leftActive || rightActive) close(); // Close Slidebars if open. - } - } - initialise(); - - // --------------- - // 005 - Animation - - var animation, // Animation type. - $slide = $('.sb-slide'); // Cache all elements to animate. - - // Set Animation Type - if (supportTransition && supportTransform) { // Browser supports CSS Transitions - animation = 'translate'; // Translate for browser that support transform and tranisions. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - - $('html').addClass('sb-anim-type-' + animation); // Add animation type class. - - // Animate Mixin - function animate (selector, amount, side) { - if (animation === 'translate') { - selector.css({ - 'transform': 'translate(' + amount + ')' - }); - } else if (animation === 'side') { - selector.css(side, amount); - } else if (animation === 'jQuery') { - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); - } - } - - // ---------------- - // 006 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (this.init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - var leftWidth = $left.css('width'); // Get the width of the left Slidebar. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - animate($slide, leftWidth, 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (this.init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - var rightWidth = $right.css('width'); // Get the width of the right Slidebar. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - animate($slide, '-' + rightWidth, 'left'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. - } - } - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - leftActive = false; // Set active variable. - rightActive = false; // Set active variable. - animate($slide, '0px', 'left'); // Animation - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if (link) window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (leftActive) { - close(); // Slidebar is open, close it. - } else if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } - } else if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (rightActive) { - close(); // Slidebar is open, close it. - } else if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } - } - } - - // --------- - // 007 - API - - this.open = open; // Maps user variable name to the open method. - this.close = close; // Maps user variable name to the close method. - this.toggle = toggle; // Maps user variable name to the toggle method. - - // -------------------- - // 008 - Window Resizes - - function resize() { - setMinHeights(); // Reset the minimum heights. - initialise(); // Check new screen sizes to see if Slidebars should still operate. - if (leftActive) { // Left Slidebar is open whilst the window is resized. - open('left'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } else if (rightActive) { // Right Slidebar is open whilst the window is resized. - open('right'); // Running the open method will ensure the slidebar is the correct width for new screen size. - } - } - $(window).resize(resize); - - // ---------------- - // 009 - User Input - - function input(event) { // Stop default behaviour and event bubbling. - event.preventDefault(); - event.stopPropagation(); - } - - // Slidebar Toggle Left - $('.sb-toggle-left').on('touchend click', function(event) { - input(event); - toggle('left'); // Toggle left Slidebar. - }); - - // Slidebar Toggle Right - $('.sb-toggle-right').on('touchend click', function(event) { - input(event); - toggle('right'); // Toggle right Slidebar. - }); - - // Slidebar Left Open - $('.sb-open-left').on('touchend click', function(event) { - input(event); - if (!leftActive) open('left'); // Slidebar is closed, open it. - }); - - // Slidebar Right Open - $('.sb-open-right').on('touchend click', function(event) { - input(event); - if (!rightActive) open('right'); // Slidebar is closed, open it. - }); - - // Slidebar Close - $('.sb-close').on('touchend click', function(event) { - input(event); - if (leftActive || rightActive) close(); // A Slidebar is open, close it. - }); - - // Slidebar Close via Link - $('.sb-slidebar a').not('.sb-disable-close').on('click', function(event) { - if (leftActive || rightActive) { // Only proceed is a Slidebar is active. - input(event); - close( $(this).attr('href') ); // Call closing method and pass link. - } - }); - - // Slidebar Close via Site - $site.on('touchend click', function(event) { - if (leftActive || rightActive) { // Only proceed if the left or the right Slidebar is active. - input(event); // If active, stop the click bubbling. - close(); // Close the Slidebar. - } - }); - - }; // End slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.8/slidebars.min.css b/distribution/0.8/slidebars.min.css deleted file mode 100644 index 8c09186..0000000 --- a/distribution/0.8/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.8 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt */ -html,body,#sb-site,.sb-slidebar{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{width:100%;overflow-x:hidden}html{min-height:100%}body{height:100%}#sb-site{width:100%;min-height:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{height:100%;width:30%;overflow-y:auto;position:fixed;top:0;z-index:0;visibility:hidden;background-color:#222}.sb-static{position:absolute}.sb-left{left:0}.sb-right{right:0}html.sb-active-left .sb-left,html.sb-active-right .sb-right{visibility:visible}@media(max-width:480px){.sb-slidebar{width:70%}}@media(min-width:481px){.sb-slidebar{width:55%}}@media(min-width:768px){.sb-slidebar{width:40%}}@media(min-width:992px){.sb-slidebar{width:30%}}@media(min-width:1200px){.sb-slidebar{width:20%}}html.sb-anim-type-translate .sb-slide,html.sb-anim-type-side .sb-slide{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left;-webkit-backface-visibility:hidden} \ No newline at end of file diff --git a/distribution/0.8/slidebars.min.js b/distribution/0.8/slidebars.min.js deleted file mode 100644 index 00db926..0000000 --- a/distribution/0.8/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.8 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt -;(function(a){a.slidebars=function(b){var v=a.extend({siteClose:true,disableOver:false,hideControlClasses:false},b);var s=document.createElement("div").style,q=false,j=false;if(s.MozTransition===""||s.WebkitTransition===""||s.OTransition===""||s.transition===""){q=true}if(s.MozTransform===""||s.WebkitTransform===""||s.OTransform===""||s.transform===""){j=true}var p=navigator.userAgent,x=false;if(p.match(/Android/)){x=parseFloat(p.slice(p.indexOf("Android")+8));if(x<3){a("html").addClass("sb-android")}}if(!a("#sb-site").length){a("body").children().wrapAll('
')}var o=a("#sb-site");if(!o.parent().is("body")){o.appendTo("body")}o.addClass("sb-slide");if(a(".sb-left").length){var d=a(".sb-left"),e=false;if(!d.parent().is("body")){d.appendTo("body")}if(x&&x<3){d.addClass("sb-static")}if(d.hasClass("sb-width-custom")){d.css("width",d.attr("data-sb-width"))}}if(a(".sb-right").length){var g=a(".sb-right"),i=false;if(!g.parent().is("body")){g.appendTo("body")}if(x&&x<3){g.addClass("sb-static")}if(g.hasClass("sb-width-custom")){g.css("width",g.attr("data-sb-width"))}}function r(){var y=a("html").css("height");o.css("minHeight",y);if(d.hasClass("sb-static")){d.css("minHeight",y)}if(g.hasClass("sb-static")){g.css("minHeight",y)}}r();var u=a(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close");function n(){var y=a(window).width();if(!v.disableOver||(typeof v.disableOver==="number"&&v.disableOver>=y)){this.init=true;a("html").addClass("sb-init");if(v.hideControlClasses){u.show()}}else{if(typeof v.disableOver==="number"&&v.disableOver'); // Check if content is wrapped with sb-site, wrap if it isn't. - var $site = $('#sb-site'); // Cache the selector. - if (!$site.parent().is('body')) $site.appendTo('body'); // Check its location and move if necessary. - - // Left Slidebar - if ($('.sb-left').length) { // Check if the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - $left.addClass('sb-slidebar'); // Make sure the Slidebar has the base class. - if (!$left.parent().is('body')) $left.appendTo('body'); // Check its location and move if necessary. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check if the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - $right.addClass('sb-slidebar'); // Make sure the Slidebar has the base class. - if (!$right.parent().is('body')) $right.appendTo('body'); // Check its location and move if necessary. - } - - var init = false, - windowWidth = $(window).width(), // Get width of window. - $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'), // Cache the control classes. - $slide = $('.sb-slide'); // Cache users elements to animate. - - // Initailise Slidebars - function initialise() { - if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. - init = true; // true enabled Slidebars to open. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.removeClass('sb-hide'); // Remove class just incase Slidebars was originally disabled. - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. - init = false; // false stop Slidebars from opening. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.addClass('sb-hide'); // Hide controls - if (leftActive || rightActive) close(); // Close Slidebars if open. - } - } - initialise(); - - // Inline CSS - function css() { - // Set minimum height. - $site.css('minHeight', ''); // Reset minimum height. - $site.css('minHeight', $('body').height() + 'px'); // Set minimum height of the site to the minimum height of the body. - - // Set off-canvas margins for Slidebars with push and overlay animations. - if ($left && ($left.hasClass('sb-style-push') || $left.hasClass('sb-style-overlay'))) $left.css('marginLeft', '-' + $left.css('width')); - if ($right && ($right.hasClass('sb-style-push') || $right.hasClass('sb-style-overlay'))) $right.css('marginRight', '-' + $right.css('width')); - - // Custom Slidebar Widths - if ($left && $left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - if ($right && $right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. - } - css(); - - // Resize Functions - $(window).resize(function() { - var resizedWindowWidth = $(window).width(); // Get resized window width. - if (windowWidth !== resizedWindowWidth) { // Window was actually resized. - windowWidth = resizedWindowWidth; // Set the new window width. - initialise(); // Call initalise to see if Slidebars should still be running. - css(); // Reset minimum heights and negative margins. - if (leftActive) open('left'); // If left Slidebar is open, calling open will ensure it is the correct size. - if (rightActive) open('right'); // If right Slidebar is open, calling open will ensure it is the correct size. - } - }); - // I may include a height check along side a width check here in future. - - // --------------- - // 005 - Animation - - var animation; // Animation type. - - // Set Animation Type - if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. - animation = 'translate'; // Translate for browsers that support it. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - - // Animate Mixin - function animate(object, amount, side) { - // Choose selectors depending on animation style. - var selector; - - if (object.hasClass('sb-style-push')) { - selector = $site.add(object).add($slide); // Push - Animate site, Slidebar and user elements. - } else if (object.hasClass('sb-style-overlay')) { - selector = object; // Overlay - Animate Slidebar only. - } else { - selector = $site.add($slide); // Reveal - Animate site and user elements. - } - - // Apply Animation - if (animation === 'translate') { - selector.css('transform', 'translate(' + amount + ')'); - } else if (animation === 'side') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for side animations. - selector.css(side, amount); - setTimeout(function() { - if (amount === '0px') { - selector.removeAttr('style'); - css(); - } - }, 400); - } else if (animation === 'jQuery') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for jQuery animations. - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); // Stop any current jQuery animation before starting another. - setTimeout(function() { - if (amount === '0px') { - selector.removeAttr('style'); - css(); - } - }, 400); // If closed, remove the inline styling on completion of the animation. - } - } - - // ---------------- - // 006 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - $left.addClass('sb-active'); - animate($left, $left.css('width'), 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - $right.addClass('sb-active'); - animate($right, '-' + $right.css('width'), 'right'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. - } - } - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - if (leftActive) { - animate($left, '0px', 'left'); // Animation - leftActive = false; - } - if (rightActive) { - animate($right, '0px', 'right'); // Animation - rightActive = false; - } - - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if ($left) $left.removeClass('sb-active'); - if ($right) $right.removeClass('sb-active'); - if (link) window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - } - - // --------- - // 007 - API - - this.open = open; // Maps user variable name to the open method. - this.close = close; // Maps user variable name to the close method. - this.toggle = toggle; // Maps user variable name to the toggle method. - this.init = function() { // Returns true or false whether Slidebars are running or not. - return init; - }; - this.active = function(side) { // Returns true or false whether Slidebar is open or closed. - if (side === 'left' && $left) return leftActive; - if (side === 'right' && $right) return rightActive; - }; - - // ---------------- - // 008 - User Input - - function eventHandler(event, selector) { - event.stopPropagation(); // Stop event bubbling. - event.preventDefault(); // Prevent default behaviour - if (event.type === 'touchend') selector.off('click'); // If event type was touch turn off clicks to prevent phantom clicks. - } - - // Toggle Left Slidebar - $('.sb-toggle-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('left'); // Toggle the left Slidbar. - }); - - // Toggle Right Slidebar - $('.sb-toggle-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('right'); // Toggle the right Slidbar. - }); - - // Open Left Slidebar - $('.sb-open-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('left'); // Open the left Slidebar. - }); - - // Open Right Slidebar - $('.sb-open-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('right'); // Open the right Slidebar. - }); - - // Close a Slidebar - $('.sb-close').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - close(); // Close either Slidebar. - }); - - // Close Slidebar via Link - $('.sb-slidebar a').not('.sb-disable-close').on('click', function(event) { - eventHandler(event, $(this)); // Handle the event. - close( $(this).attr('href') ); // Close the Slidebar and pass link. - }); - - // Close Slidebar via Site - $site.on('touchend click', function(event) { - if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. - eventHandler(event, $(this)); // Handle the event. - close(); // Close it. - } - }); - - }; // End slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.9.4/slidebars.min.css b/distribution/0.9.4/slidebars.min.css deleted file mode 100644 index 3b64114..0000000 --- a/distribution/0.9.4/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.9.4 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt */ -html,body,#sb-site,.sb-slidebar{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{width:100%;overflow-x:hidden}html{height:100%}body{min-height:100%;position:relative}#sb-site{width:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;visibility:hidden;background-color:#222}.sb-left{left:0}.sb-right{right:0}html.sb-static .sb-slidebar,.sb-slidebar.sb-static{position:absolute}.sb-slidebar.sb-active{visibility:visible}.sb-slidebar.sb-style-overlay{z-index:9999}.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}@media(max-width:480px){.sb-slidebar{width:70%}.sb-width-thin{width:55%}.sb-width-wide{width:85%}}@media(min-width:481px){.sb-slidebar{width:55%}.sb-width-thin{width:40%}.sb-width-wide{width:70%}}@media(min-width:768px){.sb-slidebar{width:40%}.sb-width-thin{width:25%}.sb-width-wide{width:55%}}@media(min-width:992px){.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}}@media(min-width:1200px){.sb-slidebar{width:20%}.sb-width-thin{width:5%}.sb-width-wide{width:35%}}.sb-slide,#sb-site,.sb-slidebar{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left,right;-webkit-backface-visibility:hidden}.sb-hide{display:none} \ No newline at end of file diff --git a/distribution/0.9.4/slidebars.min.js b/distribution/0.9.4/slidebars.min.js deleted file mode 100644 index 8bab0bc..0000000 --- a/distribution/0.9.4/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.9.4 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt -;(function(a){a.slidebars=function(b){var x=a.extend({siteClose:true,disableOver:false,hideControlClasses:false},b);var v=document.createElement("div").style,t=false,k=false;if(v.MozTransition===""||v.WebkitTransition===""||v.OTransition===""||v.transition===""){t=true}if(v.MozTransform===""||v.WebkitTransform===""||v.OTransform===""||v.transform===""){k=true}var s=navigator.userAgent,y=false,c=false;if(/Android/.test(s)){y=s.substr(s.indexOf("Android")+8,3)}else{if(/(iPhone|iPod|iPad)/.test(s)){c=s.substr(s.indexOf("OS ")+3,3).replace("_",".")}}if(y&&y<3||c&&c<5){a("html").addClass("sb-static")}if(!a("#sb-site").length){a("body").children().wrapAll('
')}var q=a("#sb-site");if(!q.parent().is("body")){q.appendTo("body")}if(a(".sb-left").length){var e=a(".sb-left"),g=false;e.addClass("sb-slidebar");if(!e.parent().is("body")){e.appendTo("body")}}if(a(".sb-right").length){var h=a(".sb-right"),j=false;h.addClass("sb-slidebar");if(!h.parent().is("body")){h.appendTo("body")}}var r=false,z=a(window).width(),w=a(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"),m=a(".sb-slide");function o(){if(!x.disableOver||(typeof x.disableOver==="number"&&x.disableOver>=z)){r=true;a("html").addClass("sb-init");if(x.hideControlClasses){w.removeClass("sb-hide")}}else{if(typeof x.disableOver==="number"&&x.disableOver'); // Check if content is wrapped with sb-site, wrap if it isn't. - var $site = $('#sb-site'); // Cache the selector. - if (!$site.parent().is('body')) $site.appendTo('body'); // Check its location and move if necessary. - - // Left Slidebar - if ($('.sb-left').length) { // Check if the left Slidebar exists. - var $left = $('.sb-left'), // Cache the selector. - leftActive = false; // Used to check whether the left Slidebar is open or closed. - $left.addClass('sb-slidebar'); // Make sure the Slidebar has the base class. - if (!$left.parent().is('body')) $left.appendTo('body'); // Check its location and move if necessary. - } - - // Right Slidebar - if ($('.sb-right').length) { // Check if the right Slidebar exists. - var $right = $('.sb-right'), // Cache the selector. - rightActive = false; // Used to check whether the right Slidebar is open or closed. - $right.addClass('sb-slidebar'); // Make sure the Slidebar has the base class. - if (!$right.parent().is('body')) $right.appendTo('body'); // Check its location and move if necessary. - } - - var init = false, - windowWidth = $(window).width(), // Get width of window. - $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'), // Cache the control classes. - $slide = $('.sb-slide'); // Cache users elements to animate. - - // Initailise Slidebars - function initialise() { - if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. - init = true; // true enabled Slidebars to open. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.removeClass('sb-hide'); // Remove class just incase Slidebars was originally disabled. - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. - init = false; // false stop Slidebars from opening. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.addClass('sb-hide'); // Hide controls - if (leftActive || rightActive) close(); // Close Slidebars if open. - } - } - initialise(); - - // Inline CSS - function css() { - // Set minimum height. - $site.css('minHeight', ''); // Reset minimum height. - $site.css('minHeight', $('body').height() + 'px'); // Set minimum height of the site to the minimum height of the body. - - // Set off-canvas margins for Slidebars with push and overlay animations. - if ($left && ($left.hasClass('sb-style-push') || $left.hasClass('sb-style-overlay'))) $left.css('marginLeft', '-' + $left.css('width')); - if ($right && ($right.hasClass('sb-style-push') || $right.hasClass('sb-style-overlay'))) $right.css('marginRight', '-' + $right.css('width')); - - // Custom Slidebar Widths - if ($left && $left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - if ($right && $right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. - } - css(); - - // Resize Functions - $(window).resize(function() { - var resizedWindowWidth = $(window).width(); // Get resized window width. - if (windowWidth !== resizedWindowWidth) { // Window was actually resized. - windowWidth = resizedWindowWidth; // Set the new window width. - initialise(); // Call initalise to see if Slidebars should still be running. - css(); // Reset minimum heights and negative margins. - if (leftActive) open('left'); // If left Slidebar is open, calling open will ensure it is the correct size. - if (rightActive) open('right'); // If right Slidebar is open, calling open will ensure it is the correct size. - } - }); - // I may include a height check along side a width check here in future. - - // --------------- - // 005 - Animation - - var animation; // Animation type. - - // Set Animation Type - if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. - animation = 'translate'; // Translate for browsers that support it. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. - } else { - animation = 'jQuery'; // Browsers that don't support css transitions and transitions. - } - - // Animate Mixin - function animate(object, amount, side) { - // Choose selectors depending on animation style. - var selector; - - if (object.hasClass('sb-style-push')) { - selector = $site.add(object).add($slide); // Push - Animate site, Slidebar and user elements. - } else if (object.hasClass('sb-style-overlay')) { - selector = object; // Overlay - Animate Slidebar only. - } else { - selector = $site.add($slide); // Reveal - Animate site and user elements. - } - - // Apply Animation - if (animation === 'translate') { - selector.css('transform', 'translate(' + amount + ')'); - } else if (animation === 'side') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for side animations. - selector.css(side, amount); - setTimeout(function() { - if (amount === '0px') { - selector.removeAttr('style'); - css(); - } - }, 400); - } else if (animation === 'jQuery') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for jQuery animations. - var properties = {}; - properties[side] = amount; - selector.stop().animate(properties, 400); // Stop any current jQuery animation before starting another. - setTimeout(function() { - if (amount === '0px') { - selector.removeAttr('style'); - css(); - } - }, 400); // If closed, remove the inline styling on completion of the animation. - } - } - - // ---------------- - // 006 - Operations - - // Open a Slidebar - function open(side) { - // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. - close(); - setTimeout(proceed, 400); - } else { // Its not open, continue. - proceed(); - } - - // Open - function proceed() { - if (init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - $left.addClass('sb-active'); - animate($left, $left.css('width'), 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - $right.addClass('sb-active'); - animate($right, '-' + $right.css('width'), 'right'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. - } - } - } - - // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - if (leftActive) { - animate($left, '0px', 'left'); // Animation - leftActive = false; - } - if (rightActive) { - animate($right, '0px', 'right'); // Animation - rightActive = false; - } - - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if ($left) $left.removeClass('sb-active'); - if ($right) $right.removeClass('sb-active'); - if (link) window.location = link; // If a link has been passed to the function, go to it. - }, 400); - } - } - - // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (!leftActive) { - open('left'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (!rightActive) { - open('right'); // Slidebar is closed, open it. - } else { - close(); // Slidebar is open, close it. - } - } - } - - // --------- - // 007 - API - - this.open = open; // Maps user variable name to the open method. - this.close = close; // Maps user variable name to the close method. - this.toggle = toggle; // Maps user variable name to the toggle method. - this.init = function() { // Returns true or false whether Slidebars are running or not. - return init; - }; - this.active = function(side) { // Returns true or false whether Slidebar is open or closed. - if (side === 'left' && $left) return leftActive; - if (side === 'right' && $right) return rightActive; - }; - - // ---------------- - // 008 - User Input - - function eventHandler(event, selector) { - event.stopPropagation(); // Stop event bubbling. - event.preventDefault(); // Prevent default behaviour - if (event.type === 'touchend') selector.off('click'); // If event type was touch turn off clicks to prevent phantom clicks. - } - - // Toggle Left Slidebar - $('.sb-toggle-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('left'); // Toggle the left Slidbar. - }); - - // Toggle Right Slidebar - $('.sb-toggle-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('right'); // Toggle the right Slidbar. - }); - - // Open Left Slidebar - $('.sb-open-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('left'); // Open the left Slidebar. - }); - - // Open Right Slidebar - $('.sb-open-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('right'); // Open the right Slidebar. - }); - - // Close a Slidebar - $('.sb-close').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - close(); // Close either Slidebar. - }); - - // Close Slidebar via Link - $('.sb-slidebar a').not('.sb-disable-close').on('click', function(event) { - eventHandler(event, $(this)); // Handle the event. - close( $(this).attr('href') ); // Close the Slidebar and pass link. - }); - - // Close Slidebar via Site - $site.on('touchend click', function(event) { - if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. - eventHandler(event, $(this)); // Handle the event. - close(); // Close it. - } - }); - - }; // End slidebars function. - -}) (jQuery); \ No newline at end of file diff --git a/distribution/0.9/slidebars.min.css b/distribution/0.9/slidebars.min.css deleted file mode 100644 index d35c8a0..0000000 --- a/distribution/0.9/slidebars.min.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Slidebars 0.9 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt */ -html,body,#sb-site,.sb-slidebar{margin:0;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{width:100%;overflow-x:hidden}html{height:100%}body{min-height:100%;position:relative}#sb-site{width:100%;height:100%;position:relative;z-index:1;background-color:#fff}.sb-slidebar{height:100%;overflow-y:auto;position:fixed;top:0;z-index:0;visibility:hidden;background-color:#222}.sb-left{left:0}.sb-right{right:0}html.sb-static .sb-slidebar,.sb-slidebar.sb-static{position:absolute}.sb-slidebar.sb-active{visibility:visible}.sb-slidebar.sb-style-overlay{z-index:9999}.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}@media(max-width:480px){.sb-slidebar{width:70%}.sb-width-thin{width:55%}.sb-width-wide{width:85%}}@media(min-width:481px){.sb-slidebar{width:55%}.sb-width-thin{width:40%}.sb-width-wide{width:70%}}@media(min-width:768px){.sb-slidebar{width:40%}.sb-width-thin{width:25%}.sb-width-wide{width:55%}}@media(min-width:992px){.sb-slidebar{width:30%}.sb-width-thin{width:15%}.sb-width-wide{width:45%}}@media(min-width:1200px){.sb-slidebar{width:20%}.sb-width-thin{width:5%}.sb-width-wide{width:35%}}.sb-slide,#sb-site,.sb-slidebar{-webkit-transition:-webkit-transform 400ms ease;-moz-transition:-moz-transform 400ms ease;-o-transition:-o-transform 400ms ease;transition:transform 400ms ease;-webkit-transition-property:-webkit-transform,left,right;-webkit-backface-visibility:hidden}.sb-hide{display:none} \ No newline at end of file diff --git a/distribution/0.9/slidebars.min.js b/distribution/0.9/slidebars.min.js deleted file mode 100644 index 207ebdf..0000000 --- a/distribution/0.9/slidebars.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// Slidebars 0.9 - http://plugins.adchsm.me/slidebars/ Written by Adam Smith - http://www.adchsm.me/ Released under MIT License - http://plugins.adchsm.me/slidebars/license.txt -;(function(a){a.slidebars=function(b){var x=a.extend({siteClose:true,disableOver:false,hideControlClasses:false},b);var v=document.createElement("div").style,t=false,k=false;if(v.MozTransition===""||v.WebkitTransition===""||v.OTransition===""||v.transition===""){t=true}if(v.MozTransform===""||v.WebkitTransform===""||v.OTransform===""||v.transform===""){k=true}var s=navigator.userAgent,y=false,c=false;if(/Android/.test(s)){y=s.substr(s.indexOf("Android")+8,3)}else{if(/(iPhone|iPod|iPad)/.test(s)){c=s.substr(s.indexOf("OS ")+3,3).replace("_",".")}}if(y&&y<3||c&&c<5){a("html").addClass("sb-static")}if(!a("#sb-site").length){a("body").children().wrapAll('
')}var q=a("#sb-site");if(!q.parent().is("body")){q.appendTo("body")}if(a(".sb-left").length){var e=a(".sb-left"),g=false;e.addClass("sb-slidebar");if(!e.parent().is("body")){e.appendTo("body")}}if(a(".sb-right").length){var h=a(".sb-right"),j=false;h.addClass("sb-slidebar");if(!h.parent().is("body")){h.appendTo("body")}}var r=false,z=a(window).width(),w=a(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"),m=a(".sb-slide");function o(){if(!x.disableOver||(typeof x.disableOver==="number"&&x.disableOver>=z)){r=true;a("html").addClass("sb-init");if(x.hideControlClasses){w.removeClass("sb-hide")}}else{if(typeof x.disableOver==="number"&&x.disableOver= windowWidth)) { // False or larger than window size. + function initialise () { + if ( ! settings.disableOver || ( typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth ) ) { // False or larger than window size. init = true; // true enabled Slidebars to open. - $('html').addClass('sb-init'); // Add helper class. - if (settings.hideControlClasses) $controls.removeClass('sb-hide'); // Remove class just incase Slidebars was originally disabled. + $( 'html' ).addClass( 'sb-init' ); // Add helper class. + if ( settings.hideControlClasses ) $controls.removeClass( 'sb-hide' ); // Remove class just incase Slidebars was originally disabled. css(); // Set required inline styles. - } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. + } else if ( typeof settings.disableOver === 'number' && settings.disableOver < windowWidth ) { // Less than window size. init = false; // false stop Slidebars from opening. - $('html').removeClass('sb-init'); // Remove helper class. - if (settings.hideControlClasses) $controls.addClass('sb-hide'); // Hide controls - $site.css('minHeight', ''); // Remove minimum height. - if (leftActive || rightActive) close(); // Close Slidebars if open. + $( 'html' ).removeClass( 'sb-init' ); // Remove helper class. + if ( settings.hideControlClasses ) $controls.addClass( 'sb-hide' ); // Hide controls + $site.css( 'minHeight', '' ); // Remove minimum height. + if ( leftActive || rightActive ) close(); // Close Slidebars if open. } } initialise(); // Inline CSS function css() { - // Set minimum height. - $site.css('minHeight', ''); // Reset minimum height. - $site.css('minHeight', $('html').height() + 'px'); // Set minimum height of the site to the minimum height of the html. + // Site container height. + $site.css( 'minHeight', '' ); + var siteHeight = parseInt( $site.css( 'height' ), 10 ), + htmlHeight = parseInt( $( 'html' ).css( 'height' ), 10 ); + if ( siteHeight < htmlHeight ) $site.css( 'minHeight', $( 'html' ).css( 'height' ) ); // Test height for vh support.. // Custom Slidebar widths. - if ($left && $left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. - if ($right && $right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. + if ( $left && $left.hasClass( 'sb-width-custom' ) ) $left.css( 'width', $left.attr( 'data-sb-width' ) ); // Set user custom width. + if ( $right && $right.hasClass( 'sb-width-custom' ) ) $right.css( 'width', $right.attr( 'data-sb-width' ) ); // Set user custom width. // Set off-canvas margins for Slidebars with push and overlay animations. - if ($left && ($left.hasClass('sb-style-push') || $left.hasClass('sb-style-overlay'))) $left.css('marginLeft', '-' + $left.css('width')); - if ($right && ($right.hasClass('sb-style-push') || $right.hasClass('sb-style-overlay'))) $right.css('marginRight', '-' + $right.css('width')); + if ( $left && ( $left.hasClass( 'sb-style-push' ) || $left.hasClass( 'sb-style-overlay' ) ) ) $left.css( 'marginLeft', '-' + $left.css( 'width' ) ); + if ( $right && ( $right.hasClass( 'sb-style-push' ) || $right.hasClass( 'sb-style-overlay' ) ) ) $right.css( 'marginRight', '-' + $right.css( 'width' ) ); // Site scroll locking. - if (settings.scrollLock) $('html').addClass('sb-scroll-lock'); + if ( settings.scrollLock ) $( 'html' ).addClass( 'sb-scroll-lock' ); } // Resize Functions - $(window).resize(function() { - var resizedWindowWidth = $(window).width(); // Get resized window width. - if (windowWidth !== resizedWindowWidth) { // Slidebars is running and window was actually resized. + $( window ).resize( function () { + var resizedWindowWidth = $( window ).width(); // Get resized window width. + if ( windowWidth !== resizedWindowWidth ) { // Slidebars is running and window was actually resized. windowWidth = resizedWindowWidth; // Set the new window width. initialise(); // Call initalise to see if Slidebars should still be running. - if (leftActive) open('left'); // If left Slidebar is open, calling open will ensure it is the correct size. - if (rightActive) open('right'); // If right Slidebar is open, calling open will ensure it is the correct size. + if ( leftActive ) open( 'left' ); // If left Slidebar is open, calling open will ensure it is the correct size. + if ( rightActive ) open( 'right' ); // If right Slidebar is open, calling open will ensure it is the correct size. } - }); + } ); // I may include a height check along side a width check here in future. // --------------- @@ -139,115 +141,125 @@ var animation; // Animation type. // Set animation type. - if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. + if ( supportTransition && supportTransform ) { // Browser supports css transitions and transforms. animation = 'translate'; // Translate for browsers that support it. - if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. + if ( android && android < 4.4 ) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. } else { animation = 'jQuery'; // Browsers that don't support css transitions and transitions. } // Animate mixin. - function animate(object, amount, side) { + function animate( object, amount, side ) { + // Choose selectors depending on animation style. var selector; - if (object.hasClass('sb-style-push')) { - selector = $site.add(object).add($slide); // Push - Animate site, Slidebar and user elements. - } else if (object.hasClass('sb-style-overlay')) { + if ( object.hasClass( 'sb-style-push' ) ) { + selector = $site.add( object ).add( $slide ); // Push - Animate site, Slidebar and user elements. + } else if ( object.hasClass( 'sb-style-overlay' ) ) { selector = object; // Overlay - Animate Slidebar only. } else { - selector = $site.add($slide); // Reveal - Animate site and user elements. + selector = $site.add( $slide ); // Reveal - Animate site and user elements. } // Apply animation - if (animation === 'translate') { - selector.css('transform', 'translate(' + amount + ')'); // Apply the animation. + if ( animation === 'translate' ) { + if ( amount === '0px' ) { + removeAnimation(); + } else { + selector.css( 'transform', 'translate( ' + amount + ' )' ); // Apply the animation. + } - } else if (animation === 'side') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for side animations. - if (amount !== '0px') selector.css(side, '0px'); // Add a 0 value so css transition works. - setTimeout(function() { // Set a timeout to allow the 0 value to be applied above. - selector.css(side, amount); // Apply the animation. - }, 1); + } else if ( animation === 'side' ) { + if ( amount === '0px' ) { + removeAnimation(); + } else { + if ( amount[0] === '-' ) amount = amount.substr( 1 ); // Remove the '-' from the passed amount for side animations. + selector.css( side, '0px' ); // Add a 0 value so css transition works. + setTimeout( function () { // Set a timeout to allow the 0 value to be applied above. + selector.css( side, amount ); // Apply the animation. + }, 1 ); + } - } else if (animation === 'jQuery') { - if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for jQuery animations. + } else if ( animation === 'jQuery' ) { + if ( amount[0] === '-' ) amount = amount.substr( 1 ); // Remove the '-' from the passed amount for jQuery animations. var properties = {}; properties[side] = amount; - selector.stop().animate(properties, 400); // Stop any current jQuery animation before starting another. + selector.stop().animate( properties, 400 ); // Stop any current jQuery animation before starting another. } - // If closed, remove the inline styling on completion of the animation. - setTimeout(function() { - if (amount === '0px') { - selector.removeAttr('style'); - css(); - } - }, 400); + // Remove animation + function removeAnimation () { + selector.removeAttr( 'style' ); + css(); + } } // ---------------- // 006 - Operations // Open a Slidebar - function open(side) { + function open( side ) { // Check to see if opposite Slidebar is open. - if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. + if ( side === 'left' && $left && rightActive || side === 'right' && $right && leftActive ) { // It's open, close it, then continue. close(); - setTimeout(proceed, 400); + setTimeout( proceed, 400 ); } else { // Its not open, continue. proceed(); } // Open function proceed() { - if (init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. - $('html').addClass('sb-active sb-active-left'); // Add active classes. - $left.addClass('sb-active'); - animate($left, $left.css('width'), 'left'); // Animation - setTimeout(function() { leftActive = true; }, 400); // Set active variables. - } else if (init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. - $('html').addClass('sb-active sb-active-right'); // Add active classes. - $right.addClass('sb-active'); - animate($right, '-' + $right.css('width'), 'right'); // Animation - setTimeout(function() { rightActive = true; }, 400); // Set active variables. + if ( init && side === 'left' && $left ) { // Slidebars is initiated, left is in use and called to open. + $( 'html' ).addClass( 'sb-active sb-active-left' ); // Add active classes. + $left.addClass( 'sb-active' ); + animate( $left, $left.css( 'width' ), 'left' ); // Animation + setTimeout( function () { leftActive = true; }, 400 ); // Set active variables. + } else if ( init && side === 'right' && $right ) { // Slidebars is initiated, right is in use and called to open. + $( 'html' ).addClass( 'sb-active sb-active-right' ); // Add active classes. + $right.addClass( 'sb-active' ); + animate( $right, '-' + $right.css( 'width' ), 'right' ); // Animation + setTimeout( function () { rightActive = true; }, 400 ); // Set active variables. } } } // Close either Slidebar - function close(link) { - if (leftActive || rightActive) { // If a Slidebar is open. - if (leftActive) { - animate($left, '0px', 'left'); // Animation + function close( url, target ) { + if ( leftActive || rightActive ) { // If a Slidebar is open. + if ( leftActive ) { + animate( $left, '0px', 'left' ); // Animation leftActive = false; } - if (rightActive) { - animate($right, '0px', 'right'); // Animation + if ( rightActive ) { + animate( $right, '0px', 'right' ); // Animation rightActive = false; } - setTimeout(function() { // Wait for closing animation to finish. - $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. - if ($left) $left.removeClass('sb-active'); - if ($right) $right.removeClass('sb-active'); - if (typeof link !== 'undefined') window.location = link; // If a link has been passed to the function, go to it. - }, 400); + setTimeout( function () { // Wait for closing animation to finish. + $( 'html' ).removeClass( 'sb-active sb-active-left sb-active-right' ); // Remove active classes. + if ( $left ) $left.removeClass( 'sb-active' ); + if ( $right ) $right.removeClass( 'sb-active' ); + if ( typeof url !== 'undefined' ) { // If a link has been passed to the function, go to it. + if ( typeof target === undefined ) target = '_self'; // Set to _self if undefined. + window.open( url, target ); // Open the url. + } + }, 400 ); } } // Toggle either Slidebar - function toggle(side) { - if (side === 'left' && $left) { // If left Slidebar is called and in use. - if (!leftActive) { - open('left'); // Slidebar is closed, open it. + function toggle( side ) { + if ( side === 'left' && $left ) { // If left Slidebar is called and in use. + if ( ! leftActive ) { + open( 'left' ); // Slidebar is closed, open it. } else { close(); // Slidebar is open, close it. } } - if (side === 'right' && $right) { // If right Slidebar is called and in use. - if (!rightActive) { - open('right'); // Slidebar is closed, open it. + if ( side === 'right' && $right ) { // If right Slidebar is called and in use. + if ( ! rightActive ) { + open( 'right' ); // Slidebar is closed, open it. } else { close(); // Slidebar is open, close it. } @@ -261,27 +273,27 @@ open: open, // Maps user variable name to the open method. close: close, // Maps user variable name to the close method. toggle: toggle, // Maps user variable name to the toggle method. - init: function() { // Returns true or false whether Slidebars are running or not. + init: function () { // Returns true or false whether Slidebars are running or not. return init; // Returns true or false whether Slidebars are running. }, - active: function(side) { // Returns true or false whether Slidebar is open or closed. - if (side === 'left' && $left) return leftActive; - if (side === 'right' && $right) return rightActive; + active: function ( side ) { // Returns true or false whether Slidebar is open or closed. + if ( side === 'left' && $left ) return leftActive; + if ( side === 'right' && $right ) return rightActive; }, - destroy: function(side) { // Removes the Slidebar from the DOM. - if (side === 'left' && $left) { - if (leftActive) close(); // Close if its open. - setTimeout(function() { + destroy: function ( side ) { // Removes the Slidebar from the DOM. + if ( side === 'left' && $left ) { + if ( leftActive ) close(); // Close if its open. + setTimeout( function () { $left.remove(); // Remove it. $left = false; // Set variable to false so it cannot be opened again. - }, 400); + }, 400 ); } - if (side === 'right' && $right) { - if (rightActive) close(); // Close if its open. - setTimeout(function() { + if ( side === 'right' && $right) { + if ( rightActive ) close(); // Close if its open. + setTimeout( function () { $right.remove(); // Remove it. $right = false; // Set variable to false so it cannot be opened again. - }, 400); + }, 400 ); } } }; @@ -289,61 +301,63 @@ // ---------------- // 008 - User Input - function eventHandler(event, selector) { + function eventHandler( event, selector ) { event.stopPropagation(); // Stop event bubbling. - event.preventDefault(); // Prevent default behaviour - if (event.type === 'touchend') selector.off('click'); // If event type was touch turn off clicks to prevent phantom clicks. + event.preventDefault(); // Prevent default behaviour. + if ( event.type === 'touchend' ) selector.off( 'click' ); // If event type was touch, turn off clicks to prevent phantom clicks. } // Toggle left Slidebar - $('.sb-toggle-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('left'); // Toggle the left Slidbar. - }); + $( '.sb-toggle-left' ).on( 'touchend click', function ( event ) { + eventHandler( event, $( this ) ); // Handle the event. + toggle( 'left' ); // Toggle the left Slidbar. + } ); // Toggle right Slidebar - $('.sb-toggle-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - toggle('right'); // Toggle the right Slidbar. - }); + $( '.sb-toggle-right' ).on( 'touchend click', function ( event ) { + eventHandler( event, $( this ) ); // Handle the event. + toggle( 'right' ); // Toggle the right Slidbar. + } ); // Open left Slidebar - $('.sb-open-left').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('left'); // Open the left Slidebar. - }); + $( '.sb-open-left' ).on( 'touchend click', function ( event ) { + eventHandler( event, $( this ) ); // Handle the event. + open( 'left' ); // Open the left Slidebar. + } ); // Open right Slidebar - $('.sb-open-right').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - open('right'); // Open the right Slidebar. - }); + $( '.sb-open-right' ).on( 'touchend click', function ( event ) { + eventHandler( event, $( this ) ); // Handle the event. + open( 'right' ); // Open the right Slidebar. + } ); - // Close a Slidebar - $('.sb-close').on('touchend click', function(event) { - eventHandler(event, $(this)); // Handle the event. - var link; - - // Close Slidebar via link - if ( $(this).parents('.sb-slidebar') ) { - if ( $(this).is('a') ) { - link = $(this).attr('href'); - } else if ( $(this).children('a') ) { - link = $(this).children('a').attr('href'); + // Close Slidebar + $( '.sb-close' ).on( 'touchend click', function ( event ) { + if ( $( this ).is( 'a' ) || $( this ).children().is( 'a' ) ) { // Is a link or contains a link. + if ( event.type === 'click' ) { // Make sure the user wanted to follow the link. + event.stopPropagation(); // Stop events propagating + event.preventDefault(); // Stop default behaviour + + var link = ( $( this ).is( 'a' ) ? $( this ) : $( this ).find( 'a' ) ), // Get the link selector. + url = link.attr( 'href' ), // Get the link url. + target = ( link.attr( 'target' ) ? link.attr( 'target' ) : '_self' ); // Set target, default to _self if not provided + + close( url, target ); // Close Slidebar and pass link target. } + } else { // Just a normal control class. + eventHandler( event, $( this ) ); // Handle the event. + close(); // Close Slidebar. } - - close(link); // Close Slidebar and pass link. - }); + } ); // Close Slidebar via site - $site.on('touchend click', function(event) { - if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. - eventHandler(event, $(this)); // Handle the event. + $site.on( 'touchend click', function ( event ) { + if ( settings.siteClose && ( leftActive || rightActive ) ) { // If settings permit closing by site and left or right Slidebar is open. + eventHandler( event, $( this ) ); // Handle the event. close(); // Close it. } - }); + } ); }; // End Slidebars function. -}) (jQuery); \ No newline at end of file +} ) ( jQuery ); \ No newline at end of file diff --git a/license.txt b/license.txt index 86b6760..790ec4d 100644 --- a/license.txt +++ b/license.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Adam Smith +Copyright (c) 2014 - 2015 Adam Smith Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/slidebars.jquery.json b/slidebars.jquery.json index 2d7864b..7f59330 100644 --- a/slidebars.jquery.json +++ b/slidebars.jquery.json @@ -14,7 +14,7 @@ "panel", "panel-menu" ], - "version": "0.10.2", + "version": "0.10.3", "author": { "name": "Adam Smith", "url": "http://www.adchsm.me/"