diff --git a/js/rift.js b/js/rift.js index ec9a803..ce67ea2 100644 --- a/js/rift.js +++ b/js/rift.js @@ -8,13 +8,13 @@ $.fn.rift = function () { return this.each(function () { - + // Vurribles var element = $(this), - elemImg = element.find('img'), - imgSrc = elemImg.attr('src'); - - // We be chainin' + elemImg = element.find('img'), + imgSrc = elemImg.attr('src'); + + // We be chainin' element .prepend('') .append('') @@ -25,6 +25,15 @@ .find('span.btm-span') .css('background', 'url(' + imgSrc + ') no-repeat center bottom') .css('background-size', '100%'); + + // Easy fallback for touch devices + var isTouchDevice = 'ontouchstart' in document.documentElement; + if(isTouchDevice) { + element.on('click', function(e) { + $(this).toggleClass('open'); + }) + } }); + }; -})( jQuery, window, document ); \ No newline at end of file +})( jQuery, window, document ); diff --git a/js/rift.min.js b/js/rift.min.js index 5c2095f..ed7446f 100644 --- a/js/rift.min.js +++ b/js/rift.min.js @@ -1,6 +1 @@ -/** - * Rift v1.0.0 - * @author Kyle Foster - * MIT license - */ -(function(e,t,n,r){e.fn.rift=function(){return this.each(function(){var t=e(this),n=t.find("img"),r=n.attr("src");t.prepend('').append('').find("span.top-span").css("background","url("+r+") no-repeat center top").css("background-size","100%").parent().find("span.btm-span").css("background","url("+r+") no-repeat center bottom").css("background-size","100%")})}})(jQuery,window,document) \ No newline at end of file +!function(n,s,t){n.fn.rift=function(){return this.each(function(){var s=n(this),a=s.find("img"),c=a.attr("src");s.prepend('').append('').find("span.top-span").css("background","url("+c+") no-repeat center top").css("background-size","100%").parent().find("span.btm-span").css("background","url("+c+") no-repeat center bottom").css("background-size","100%");var e="ontouchstart"in t.documentElement;e&&s.on("click",function(){n(this).toggleClass("open")})})}}(jQuery,window,document); \ No newline at end of file