parallaximage-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTM5ODJiYjU1YzllYTkyNjY2ZDBhMjlkYzJhOWRmYWVlY2E2ODlmNQ==
5
+ data.tar.gz: !binary |-
6
+ MjlkZmNhMTQ0NzRkNTM2YjA2MjA3NWU1NjUxMTRjNDg5ZGYxNzg3ZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MTJhMTg3YTU3N2ZjYzQ5YzEwNDNjMjM4YjhiOWUyOTFkMjBlMzZjODFjMTJl
10
+ ZDMzMWY4ZGEwYWY3NjA5Y2ZhNTQwNTNkOGQyNjU1NTUyODI2YWUyNTRmNGM2
11
+ MDI2OTU4MTlmNzAxMzQ2ZjJmM2E1NGRlMThkY2Q4MWQ1ZDIyMmE=
12
+ data.tar.gz: !binary |-
13
+ NjQzZTA0NzI1ZTc3YjFlMzMyNGNjMDNkYTk5YjIwODk0ODBmZDdlOGJmNTZm
14
+ MDAyMzM5YWZhYTJiMzY1MmNmZTk5Njg4MGI2ZDlmNzU2Y2I4YWQzMmVkYmFk
15
+ ZTU5ZGVmZjQ3MWI4NTBhZGM2MzQ3OGI4MjYxZWE3YzgxZDNkZjI=
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in parallaximage-rails.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 producao02
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # Parallax Hero Image Rails Gem
2
+
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'parallaximage-rails'
10
+ ```
11
+
12
+ And then execute:
13
+ ```
14
+ $ bundle install
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Add to your app/assets/javascripts/application.js
20
+
21
+ ```
22
+ //= require modernizr
23
+ //= require jquery.parallaximage
24
+ ```
25
+
26
+ And to your app/assets/stylesheets/application.css.sass or application.css.scss
27
+
28
+
29
+ ```
30
+ @import parallaximage
31
+ ```
32
+
33
+ Or application.css:
34
+
35
+ ```
36
+ *= require parallaximage
37
+ ```
38
+
39
+ ## Example
40
+ The main HTML structure is a <figure> element containing our hero image (we used 3 different <img>s) and wrapped in a .cd-background-wrapper element.
41
+
42
+ ```html
43
+ <div class="cd-background-wrapper">
44
+ <figure class="cd-floating-background">
45
+ <img src="img/cd-img-1.jpg" alt="image-1">
46
+ <!-- images here -->
47
+ </figure>
48
+ </div>
49
+ ```
50
+
51
+ ## Documentation
52
+
53
+ Usage documentation as well as demos can be found at:
54
+
55
+ http://codyhouse.co/gem/parallax-hero-image/
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,118 @@
1
+ jQuery(document).ready(function($){
2
+ //check media query
3
+ var mediaQuery = window.getComputedStyle(document.querySelector('.cd-background-wrapper'), '::before').getPropertyValue('content').replace(/"/g, ''),
4
+ //define store some initial variables
5
+ halfWindowH = $(window).height()*0.5,
6
+ halfWindowW = $(window).width()*0.5,
7
+ //define a max rotation value (X and Y axises)
8
+ maxRotationY = 5,
9
+ maxRotationX = 3,
10
+ aspectRatio;
11
+
12
+ //detect if hero <img> has been loaded and evaluate its aspect-ratio
13
+ $('.cd-floating-background').find('img').eq(0).load(function() {
14
+ aspectRatio = $(this).width()/$(this).height();
15
+ if( mediaQuery == 'web' && $('html').hasClass('preserve-3d') ) initBackground();
16
+ }).each(function() {
17
+ //check if image was previously load - if yes, trigger load event
18
+ if(this.complete) $(this).load();
19
+ });
20
+
21
+ //detect mouse movement
22
+ $('.cd-background-wrapper').on('mousemove', function(event){
23
+ if( mediaQuery == 'web' && $('html').hasClass('preserve-3d') ) {
24
+ window.requestAnimationFrame(function(){
25
+ moveBackground(event);
26
+ });
27
+ }
28
+ });
29
+
30
+ //on resize - adjust .cd-background-wrapper and .cd-floating-background dimentions and position
31
+ $(window).on('resize', function(){
32
+ mediaQuery = window.getComputedStyle(document.querySelector('.cd-background-wrapper'), '::before').getPropertyValue('content').replace(/"/g, '');
33
+ if( mediaQuery == 'web' && $('html').hasClass('preserve-3d') ) {
34
+ window.requestAnimationFrame(function(){
35
+ halfWindowH = $(window).height()*0.5,
36
+ halfWindowW = $(window).width()*0.5;
37
+ initBackground();
38
+ });
39
+ } else {
40
+ $('.cd-background-wrapper').attr('style', '');
41
+ $('.cd-floating-background').attr('style', '').removeClass('is-absolute');
42
+ }
43
+ });
44
+
45
+ function initBackground() {
46
+ var wrapperHeight = Math.ceil(halfWindowW*2/aspectRatio),
47
+ proportions = ( maxRotationY > maxRotationX ) ? 1.1/(Math.sin(Math.PI / 2 - maxRotationY*Math.PI/180)) : 1.1/(Math.sin(Math.PI / 2 - maxRotationX*Math.PI/180)),
48
+ newImageWidth = Math.ceil(halfWindowW*2*proportions),
49
+ newImageHeight = Math.ceil(newImageWidth/aspectRatio),
50
+ newLeft = halfWindowW - newImageWidth/2,
51
+ newTop = (wrapperHeight - newImageHeight)/2;
52
+
53
+ //set an height for the .cd-background-wrapper
54
+ $('.cd-background-wrapper').css({
55
+ 'height' : wrapperHeight,
56
+ });
57
+ //set dimentions and position of the .cd-background-wrapper
58
+ $('.cd-floating-background').addClass('is-absolute').css({
59
+ 'left' : newLeft,
60
+ 'top' : newTop,
61
+ 'width' : newImageWidth,
62
+ });
63
+ }
64
+
65
+ function moveBackground(event) {
66
+ var rotateY = ((-event.pageX+halfWindowW)/halfWindowW)*maxRotationY,
67
+ rotateX = ((event.pageY-halfWindowH)/halfWindowH)*maxRotationX;
68
+
69
+ if( rotateY > maxRotationY) rotateY = maxRotationY;
70
+ if( rotateY < -maxRotationY ) rotateY = -maxRotationY;
71
+ if( rotateX > maxRotationX) rotateX = maxRotationX;
72
+ if( rotateX < -maxRotationX ) rotateX = -maxRotationX;
73
+
74
+ $('.cd-floating-background').css({
75
+ '-moz-transform': 'rotateX(' + rotateX + 'deg' + ') rotateY(' + rotateY + 'deg' + ') translateZ(0)',
76
+ '-webkit-transform': 'rotateX(' + rotateX + 'deg' + ') rotateY(' + rotateY + 'deg' + ') translateZ(0)',
77
+ '-ms-transform': 'rotateX(' + rotateX + 'deg' + ') rotateY(' + rotateY + 'deg' + ') translateZ(0)',
78
+ '-o-transform': 'rotateX(' + rotateX + 'deg' + ') rotateY(' + rotateY + 'deg' + ') translateZ(0)',
79
+ 'transform': 'rotateX(' + rotateX + 'deg' + ') rotateY(' + rotateY + 'deg' + ') translateZ(0)',
80
+ });
81
+ }
82
+ });
83
+
84
+ /* Detect "transform-style: preserve-3d" support, or update csstransforms3d for IE10 ? #762
85
+ https://github.com/Modernizr/Modernizr/issues/762 */
86
+ (function getPerspective(){
87
+ var element = document.createElement('p'),
88
+ html = document.getElementsByTagName('html')[0],
89
+ body = document.getElementsByTagName('body')[0],
90
+ propertys = {
91
+ 'webkitTransformStyle':'-webkit-transform-style',
92
+ 'MozTransformStyle':'-moz-transform-style',
93
+ 'msTransformStyle':'-ms-transform-style',
94
+ 'transformStyle':'transform-style'
95
+ };
96
+
97
+ body.insertBefore(element, null);
98
+
99
+ for (var i in propertys) {
100
+ if (element.style[i] !== undefined) {
101
+ element.style[i] = "preserve-3d";
102
+ }
103
+ }
104
+
105
+ var st = window.getComputedStyle(element, null),
106
+ transform = st.getPropertyValue("-webkit-transform-style") ||
107
+ st.getPropertyValue("-moz-transform-style") ||
108
+ st.getPropertyValue("-ms-transform-style") ||
109
+ st.getPropertyValue("transform-style");
110
+
111
+ if(transform!=='preserve-3d'){
112
+ html.className += ' no-preserve-3d';
113
+ } else {
114
+ html.className += ' preserve-3d';
115
+ }
116
+ document.body.removeChild(element);
117
+
118
+ })();
@@ -0,0 +1,4 @@
1
+ /* Modernizr 2.8.3 (Custom Build) | MIT & BSD
2
+ * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
3
+ */
4
+ ;window.Modernizr=function(a,b,c){function C(a){j.cssText=a}function D(a,b){return C(n.join(a+";")+(b||""))}function E(a,b){return typeof a===b}function F(a,b){return!!~(""+a).indexOf(b)}function G(a,b){for(var d in a){var e=a[d];if(!F(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function H(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:E(f,"function")?f.bind(d||b):f}return!1}function I(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return E(b,"string")||E(b,"undefined")?G(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),H(e,b,c))}function J(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)u[c[d]]=c[d]in k;return u.list&&(u.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),u}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=E(e[d],"function"),E(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),A={}.hasOwnProperty,B;!E(A,"undefined")&&!E(A.call,"undefined")?B=function(a,b){return A.call(a,b)}:B=function(a,b){return b in a&&E(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return I("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!E(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!I("indexedDB",a)},s.hashchange=function(){return z("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return C("background-color:rgba(150,255,150,.5)"),F(j.backgroundColor,"rgba")},s.hsla=function(){return C("background-color:hsla(120,40%,100%,.5)"),F(j.backgroundColor,"rgba")||F(j.backgroundColor,"hsla")},s.multiplebgs=function(){return C("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return I("backgroundSize")},s.borderimage=function(){return I("borderImage")},s.borderradius=function(){return I("borderRadius")},s.boxshadow=function(){return I("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return D("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return I("animationName")},s.csscolumns=function(){return I("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return C((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),F(j.backgroundImage,"gradient")},s.cssreflections=function(){return I("boxReflect")},s.csstransforms=function(){return!!I("transform")},s.csstransforms3d=function(){var a=!!I("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return I("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var K in s)B(s,K)&&(x=K.toLowerCase(),e[x]=s[K](),v.push((e[x]?"":"no-")+x));return e.input||J(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)B(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},C(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function q(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?o(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function r(a){a||(a=b);var c=n(a);return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||q(a,c),a}var c="3.7.0",d=a.html5||{},e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={},k;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.hasEvent=z,e.testProp=function(a){return G([a])},e.testAllProps=I,e.testStyles=y,e.prefixed=function(a,b,c){return b?I(a,b,c):I(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
@@ -0,0 +1,110 @@
1
+ /* --------------------------------
2
+
3
+ Primary style
4
+
5
+ -------------------------------- */
6
+ *, *::after, *::before {
7
+ -webkit-box-sizing: border-box;
8
+ -moz-box-sizing: border-box;
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ html {
13
+ font-size: 62.5%;
14
+ }
15
+
16
+ body {
17
+ font-size: 1.6rem;
18
+ font-family: sans-serif;
19
+ color: #ffffff;
20
+ background: #001426 url("../images/bg-pattern.png");
21
+ }
22
+
23
+ a {
24
+ color: #196a74;
25
+ text-decoration: none;
26
+ }
27
+
28
+ /* --------------------------------
29
+
30
+ Main Components
31
+
32
+ -------------------------------- */
33
+ .cd-background-wrapper {
34
+ background-color: #001426;
35
+ position: relative;
36
+ overflow: hidden;
37
+ }
38
+ .no-touch .cd-background-wrapper {
39
+ -webkit-perspective: 4000px;
40
+ -moz-perspective: 4000px;
41
+ perspective: 4000px;
42
+ }
43
+ .cd-background-wrapper::before {
44
+ /* never visible - this is used in jQuery to check the device type */
45
+ content: 'web';
46
+ display: none;
47
+ }
48
+ .touch .cd-background-wrapper::before {
49
+ /* never visible - this is used in jQuery to check the device type */
50
+ content: 'mobile';
51
+ }
52
+
53
+ .cd-floating-background {
54
+ position: relative;
55
+ }
56
+ .cd-floating-background img {
57
+ display: block;
58
+ width: 100%;
59
+ -webkit-backface-visibility: hidden;
60
+ backface-visibility: hidden;
61
+ /* fixes a Firefox bug - images not correctly rendered*/
62
+ background-color: rgba(255, 255, 255, 0.01);
63
+ }
64
+ .cd-floating-background img:not(:first-child) {
65
+ position: absolute;
66
+ top: 0;
67
+ left: 0;
68
+ }
69
+ .no-touch .cd-floating-background {
70
+ top: 0;
71
+ left: 0;
72
+ -webkit-transform-style: preserve-3d;
73
+ -moz-transform-style: preserve-3d;
74
+ -ms-transform-style: preserve-3d;
75
+ -o-transform-style: preserve-3d;
76
+ transform-style: preserve-3d;
77
+ -webkit-transform: translateZ(0);
78
+ -moz-transform: translateZ(0);
79
+ -ms-transform: translateZ(0);
80
+ -o-transform: translateZ(0);
81
+ transform: translateZ(0);
82
+ }
83
+ .no-touch .cd-floating-background.is-absolute {
84
+ position: absolute;
85
+ }
86
+ .no-touch .cd-floating-background img:first-child {
87
+ -webkit-transform: translateZ(50px);
88
+ -moz-transform: translateZ(50px);
89
+ -ms-transform: translateZ(50px);
90
+ -o-transform: translateZ(50px);
91
+ transform: translateZ(50px);
92
+ }
93
+ .no-touch .cd-floating-background img:nth-child(2) {
94
+ -webkit-transform: translateZ(290px);
95
+ -moz-transform: translateZ(290px);
96
+ -ms-transform: translateZ(290px);
97
+ -o-transform: translateZ(290px);
98
+ transform: translateZ(290px);
99
+ }
100
+ .no-touch .cd-floating-background img:nth-child(3) {
101
+ -webkit-transform: translateZ(400px);
102
+ -moz-transform: translateZ(400px);
103
+ -ms-transform: translateZ(400px);
104
+ -o-transform: translateZ(400px);
105
+ transform: translateZ(400px);
106
+ }
107
+ .no-touch.no-preserve-3d .cd-floating-background {
108
+ /* we target browsers that don't support preserve-3d and show just a standard image - no effect visible */
109
+ position: relative;
110
+ }
@@ -0,0 +1,48 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section, main {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ }
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after {
42
+ content: '';
43
+ content: none;
44
+ }
45
+ table {
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ }
@@ -0,0 +1,8 @@
1
+ require "parallaximage-rails/version"
2
+
3
+ module Parallaximage
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Parallaximage
2
+ module Rails
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'parallaximage-rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "parallaximage-rails"
8
+ spec.version = Parallaximage::Rails::VERSION
9
+ spec.authors = ["TwoWeb"]
10
+ spec.email = ["dev@twoweb.com.br"]
11
+ spec.summary = "gem Parallax Hero Image"
12
+ spec.description = "Parallax Hero Image for rails"
13
+ spec.homepage = "https://github.com/twoweb/parallaximage-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: parallaximage-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - TwoWeb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Parallax Hero Image for rails
42
+ email:
43
+ - dev@twoweb.com.br
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - Gemfile
49
+ - LICENSE.txt
50
+ - README.md
51
+ - Rakefile
52
+ - app/assets/images/bg-pattern.png
53
+ - app/assets/images/cd-img-1.jpg
54
+ - app/assets/images/cd-img-2.png
55
+ - app/assets/images/cd-img-3.png
56
+ - app/assets/javascripts/jquery.parallaximage.js
57
+ - app/assets/javascripts/modernizr.js
58
+ - app/assets/stylesheets/parallaximage.css
59
+ - app/assets/stylesheets/reset.css
60
+ - lib/parallaximage-rails.rb
61
+ - lib/parallaximage-rails/version.rb
62
+ - parallaximage-rails.gemspec
63
+ homepage: https://github.com/twoweb/parallaximage-rails
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.0.0.rc.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: gem Parallax Hero Image
87
+ test_files: []