toolkit 0.1 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/stylesheets/_toolkit.scss +1 -6
  2. data/stylesheets/toolkit/_fluid-media.scss +2 -0
  3. data/stylesheets/toolkit/_pe.scss +115 -0
  4. data/templates/project/{partials/global/_base.scss → _base.scss} +3 -0
  5. data/templates/project/manifest.rb +22 -19
  6. data/templates/respond-to/{partials/global/_base.scss → _base.scss} +3 -0
  7. data/templates/respond-to/manifest.rb +21 -19
  8. data/templates/{project/partials/design → shared}/_design.scss +0 -0
  9. data/templates/{project/partials/global → shared}/_extendables.scss +0 -0
  10. data/templates/{project/partials/global → shared}/_functions.scss +0 -0
  11. data/templates/{project/partials/design → shared}/_ie-design.scss +0 -0
  12. data/templates/{project/partials/layout → shared}/_ie-layout.scss +0 -0
  13. data/templates/{project/partials/layout → shared}/_layout.scss +0 -0
  14. data/templates/{project/partials/global → shared}/_mixins.scss +0 -0
  15. data/templates/{project/partials/design → shared}/_print-design.scss +0 -0
  16. data/templates/{project/partials/layout → shared}/_print-layout.scss +0 -0
  17. data/templates/{project/partials/styleguide → shared}/_style-guide.scss +0 -0
  18. data/templates/{project/partials/global → shared}/_variables.scss +0 -0
  19. data/templates/{project → shared}/hammer.js +0 -0
  20. data/templates/{project → shared}/ie.scss +0 -0
  21. data/templates/{project → shared}/loader.js +0 -0
  22. data/templates/{project → shared}/modernizr-2.5.3.js +0 -0
  23. data/templates/{project → shared}/print.scss +0 -0
  24. data/templates/{project → shared}/style.scss +0 -0
  25. metadata +22 -40
  26. data/stylesheets/toolkit/_progressive-enhancement.scss +0 -57
  27. data/templates/project/embeds.respond.js +0 -37
  28. data/templates/respond-to/embeds.respond.js +0 -37
  29. data/templates/respond-to/hammer.js +0 -731
  30. data/templates/respond-to/ie.scss +0 -28
  31. data/templates/respond-to/loader.js +0 -4
  32. data/templates/respond-to/modernizr-2.5.3.js +0 -726
  33. data/templates/respond-to/partials/design/_design.scss +0 -9
  34. data/templates/respond-to/partials/design/_ie-design.scss +0 -9
  35. data/templates/respond-to/partials/design/_print-design.scss +0 -9
  36. data/templates/respond-to/partials/global/_extendables.scss +0 -6
  37. data/templates/respond-to/partials/global/_functions.scss +0 -5
  38. data/templates/respond-to/partials/global/_mixins.scss +0 -5
  39. data/templates/respond-to/partials/global/_variables.scss +0 -5
  40. data/templates/respond-to/partials/layout/_ie-layout.scss +0 -9
  41. data/templates/respond-to/partials/layout/_layout.scss +0 -9
  42. data/templates/respond-to/partials/layout/_print-layout.scss +0 -9
  43. data/templates/respond-to/partials/styleguide/_style-guide.scss +0 -10
  44. data/templates/respond-to/print.scss +0 -28
  45. data/templates/respond-to/style.scss +0 -27
@@ -3,11 +3,6 @@
3
3
  ////////////////////////
4
4
  @import 'compass';
5
5
 
6
- ////////////////////////
7
- // Compass Extensions
8
- ////////////////////////
9
- @import 'susy';
10
-
11
6
  ////////////////////////
12
7
  // Import Border Box Awesomesauce
13
8
  ////////////////////////
@@ -21,4 +16,4 @@
21
16
  ////////////////////////
22
17
  // Import Progressive Enhancement
23
18
  ////////////////////////
24
- @import 'toolkit/progressive-enhancement';
19
+ @import 'toolkit/pe';
@@ -8,6 +8,8 @@ img {
8
8
 
9
9
  ////////////////////////
10
10
  // Scaling Embeds WITH NO JAVASCIPT!
11
+ //
12
+ // From the outrageously awesome Scott Kellum
11
13
  ////////////////////////
12
14
  @mixin scale-elements($ratio: 16/9, $width: 100%, $elements: '*') {
13
15
  @extend %scaling-elements-parent;
@@ -0,0 +1,115 @@
1
+ ////////////////////////
2
+ // Enhance From
3
+ //
4
+ // - $feature: Modernizr feature (base CSS class name)
5
+ ////////////////////////
6
+ @mixin enhance-with($feature) {
7
+ .#{$feature} & {
8
+ @content;
9
+ }
10
+ }
11
+
12
+ ////////////////////////
13
+ // Degrade From
14
+ //
15
+ // - $feature: Modernizr feature (base CSS class name)
16
+ ////////////////////////
17
+ @mixin degrade-from($feature) {
18
+ .no-#{$feature} &,
19
+ .no-js & {
20
+ @content;
21
+ }
22
+ }
23
+
24
+ ////////////////////////
25
+ // Progressive Enhancement Text Replace Mixin
26
+ //
27
+ // - $png-path: The path to the pngs for the image sprite, including the *.png (just like normal image sprites)
28
+ // - $sprite: The name of the sprite you want to use (this is the file name without extension)
29
+ // - $inline-svg: Switches between a Base64 encoded SVG or a normal url() for the SVG. Default to true
30
+ // - $with-dimensions: Switches between including dimensions (height/width for all and background-size for SVG) or not. Defaults to true.
31
+ // - $inline: Whether or not the containing selector is an inline element. Defaults to false.
32
+ ////////////////////////
33
+ @mixin replace-text-pe($png-path, $sprite, $inline-svg: true, $with-dimensions: true, $inline: false) {
34
+ // Map Out the Sprite
35
+ $sprite-map: sprite-map($png-path);
36
+
37
+ // Build SVG file name
38
+ $svg-file: str-replace('*.png', '#{$sprite}.svg', $png-path);
39
+
40
+ // Default Sprite File
41
+ $sprite-file: '' !default;
42
+
43
+ @if $with-dimensions {
44
+ // Get Sprite File for Height/Width
45
+ $sprite-file: sprite-file($sprite-map, $sprite);
46
+
47
+ // Put the height/width of the image in
48
+ width: image-width($sprite-file);
49
+ height: image-height($sprite-file);
50
+ }
51
+
52
+ // Hide text. Use squish-text() if the element is inline
53
+ @if $inline {
54
+ @extend %replace-text-pe-squish;
55
+ }
56
+ @else {
57
+ @extend %replace-text-pe-hide;
58
+ }
59
+
60
+ // Enhance with SVG
61
+ @include enhance-with('svg') {
62
+ // Inline the SVG so that advanced browsers and future tech doesn't need the extra HTTP requests for the SVG
63
+ @if $inline-svg {
64
+ background-image: inline-image($svg-file);
65
+ }
66
+ @else {
67
+ background-image: image-url($svg-file);
68
+ }
69
+ // No repeating backgrounds, please
70
+ background-repeat: no-repeat;
71
+ // Set background size to ensure that our SVG is the right size.
72
+ @if $with-dimensions {
73
+ background-size: image-width($sprite-file) image-height($sprite-file);
74
+ }
75
+ }
76
+
77
+ // Degrade from SVG
78
+ @include degrade-from('svg') {
79
+ // Extend the Sprite Background
80
+ @extend %#{sprite-map-name($sprite-map)}-image-map;
81
+ // Call the Sprite'd image's position.
82
+ @include sprite($sprite-map, $sprite);
83
+ }
84
+ }
85
+
86
+ //////////////////////////////
87
+ // Sprite Map Generator
88
+ //
89
+ // Need a custom mixin to create extendable classes classes for background image for sprites because dynamic mixin names don't work.
90
+ //
91
+ // - $png-path: The path to the pngs for the image sprite, including the *.png (just like normal image sprites)
92
+ //////////////////////////////
93
+ @mixin sprite-map-generator($png-path) {
94
+ $png-path: sprite-map($png-path);
95
+ %#{sprite-map-name($png-path)}-image-map {
96
+ background: {
97
+ image: $png-path;
98
+ repeat: no-repeat;
99
+ }
100
+ }
101
+ }
102
+
103
+ //////////////////////////////
104
+ // Extendable Class for Squish Text mixin
105
+ //////////////////////////////
106
+ %replace-text-pe-squish {
107
+ @include squish-text();
108
+ }
109
+
110
+ //////////////////////////////
111
+ // Extendable Class for Hide Text mixin
112
+ //////////////////////////////
113
+ %replace-text-pe-hide {
114
+ @include hide-text();
115
+ }
@@ -8,12 +8,15 @@
8
8
 
9
9
  ////////////////////////
10
10
  // Compass Imports
11
+ //
12
+ // Toolkit include @import 'compass' so you don't need to.
11
13
  ////////////////////////
12
14
 
13
15
  ////////////////////////
14
16
  // Compass Extensions
15
17
  ////////////////////////
16
18
  @import 'toolkit';
19
+ @import 'susy';
17
20
  @import 'breakpoint';
18
21
 
19
22
  ////////////////////////
@@ -1,29 +1,31 @@
1
1
  description "Responsive Web Design Kickstart"
2
2
 
3
3
  # Stylesheets
4
- stylesheet 'style.scss', :media => 'screen, projection'
4
+ file '../shared/style.scss', :like => :stylesheet, :media => 'screen, projection', :to => 'style.scss'
5
5
 
6
- stylesheet 'partials/global/_base.scss'
7
- stylesheet 'partials/global/_variables.scss'
8
- stylesheet 'partials/global/_functions.scss'
9
- stylesheet 'partials/global/_mixins.scss'
10
- stylesheet 'partials/global/_extendables.scss'
6
+ file '_base.scss', :like => :stylesheet, :to => 'partials/global/_base.scss'
7
+ file '../shared/_variables.scss', :like => :stylesheet, :to => 'partials/global/_variables.scss'
8
+ file '../shared/_functions.scss', :like => :stylesheet, :to => 'partials/global/_functions.scss'
9
+ file '../shared/_mixins.scss', :like => :stylesheet, :to => 'partials/global/_mixins.scss'
10
+ file '../shared/_extendables.scss', :like => :stylesheet, :to => 'partials/global/_extendables.scss'
11
11
 
12
- stylesheet 'partials/styleguide/_style-guide.scss'
12
+ file '../shared/_style-guide.scss', :like => :stylesheet, :to => 'partials/styleguide/_style-guide.scss'
13
13
 
14
- stylesheet 'partials/layout/_layout.scss'
15
- stylesheet 'partials/layout/_ie-layout.scss'
16
- stylesheet 'partials/layout/_print-layout.scss'
14
+ file '../shared/_layout.scss', :like => :stylesheet, :to => 'partials/layout/_layout.scss'
15
+ file '../shared/_ie-layout.scss', :like => :stylesheet, :to => 'partials/layout/_ie-layout.scss'
16
+ file '../shared/_print-layout.scss', :like => :stylesheet, :to => 'partials/layout/_print-layout.scss'
17
17
 
18
- stylesheet 'partials/design/_design.scss'
19
- stylesheet 'partials/design/_ie-design.scss'
20
- stylesheet 'partials/design/_print-design.scss'
18
+ file '../shared/_design.scss', :like => :stylesheet, :to => 'partials/design/_design.scss'
19
+ file '../shared/_ie-design.scss', :like => :stylesheet, :to => 'partials/design/_ie-design.scss'
20
+ file '../shared/_print-design.scss', :like => :stylesheet, :to => 'partials/design/_print-design.scss'
21
21
 
22
- stylesheet 'print.scss', :media => 'print'
23
- stylesheet 'ie.scss', :media => 'screen, projection', :condition => "lt IE 8"
22
+ file '../shared/print.scss', :like => :stylesheet, :media => 'print', :to => 'print.scss'
23
+ file '../shared/ie.scss', :like => :stylesheet, :media => 'screen, projection', :condition => "lt IE 8", :to => 'ie.scss'
24
24
 
25
- # JavaScript and Images
26
- discover :javascripts
25
+ # JavaScript
26
+ file '../shared/hammer.js', :like => :javascript, :to => 'hammer.js'
27
+ file '../shared/loader.js', :like => :javascript, :to => 'loader.js'
28
+ file '../shared/modernizr-2.5.3.js', :like => :javascript, :to => 'modernizr-2.5.3.js'
27
29
 
28
30
  help %Q{
29
31
  Please contact Sam Richard or Mason Wendell with questions:
@@ -38,15 +40,16 @@ welcome_message %Q{
38
40
 
39
41
  Welcome to the Responsive Web Design Kickstart gem! Provided are the basic tools needed to kickstart a custom Responsive Web Design solution tailor made to your needs! Remember, tools and best practices are always changing, so keep up to date!
40
42
 
41
- The following is included in this build:
43
+ The following is included in this build:
42
44
  Compass Extensions:
43
45
  * Susy
46
+ * Toolkit
44
47
  * Breakpoint
48
+
45
49
  JavaScript:
46
50
  * Modernizr Custom Build with all Standard features of 2.3.5 except html5shiv w/printshiv or Media Queries. Build your own from http://modernizr.com/download/ when you are ready for production
47
51
  * Loader.js custom JavaScript file for holding conditional asset loading scripts thanks to Modernizr's yepnope (http://yepnopejs.com/). Comes with yepnope code for loading in Hammer.js, just make sure the path is correct from root.. Ready for production, but remember to minify and gzip!
48
52
  * Hammer.js (http://eightmedia.github.com/hammer.js/) for awesome touch events. Ready for production, but remember to minify and gzip!
49
- * embeds.respond.js is an fluid iFrame solution for YouTube and Vimeo embeds that requires jQuery (for the time being, not included).
50
53
 
51
54
  Include the following in your <head> tag:
52
55
 
@@ -8,12 +8,15 @@
8
8
 
9
9
  ////////////////////////
10
10
  // Compass Imports
11
+ //
12
+ // Toolkit include @import 'compass' so you don't need to.
11
13
  ////////////////////////
12
14
 
13
15
  ////////////////////////
14
16
  // Compass Extensions
15
17
  ////////////////////////
16
18
  @import 'toolkit';
19
+ @import 'susy';
17
20
  @import 'respond-to';
18
21
 
19
22
  ////////////////////////
@@ -1,29 +1,31 @@
1
1
  description "Responsive Web Design Kickstart"
2
2
 
3
3
  # Stylesheets
4
- stylesheet 'style.scss', :media => 'screen, projection'
4
+ file '../shared/style.scss', :like => :stylesheet, :media => 'screen, projection', :to => 'style.scss'
5
5
 
6
- stylesheet 'partials/global/_base.scss'
7
- stylesheet 'partials/global/_variables.scss'
8
- stylesheet 'partials/global/_functions.scss'
9
- stylesheet 'partials/global/_mixins.scss'
10
- stylesheet 'partials/global/_extendables.scss'
6
+ file '_base.scss', :like => :stylesheet, :to => 'partials/global/_base.scss'
7
+ file '../shared/_variables.scss', :like => :stylesheet, :to => 'partials/global/_variables.scss'
8
+ file '../shared/_functions.scss', :like => :stylesheet, :to => 'partials/global/_functions.scss'
9
+ file '../shared/_mixins.scss', :like => :stylesheet, :to => 'partials/global/_mixins.scss'
10
+ file '../shared/_extendables.scss', :like => :stylesheet, :to => 'partials/global/_extendables.scss'
11
11
 
12
- stylesheet 'partials/styleguide/_style-guide.scss'
12
+ file '../shared/_style-guide.scss', :like => :stylesheet, :to => 'partials/styleguide/_style-guide.scss'
13
13
 
14
- stylesheet 'partials/layout/_layout.scss'
15
- stylesheet 'partials/layout/_ie-layout.scss'
16
- stylesheet 'partials/layout/_print-layout.scss'
14
+ file '../shared/_layout.scss', :like => :stylesheet, :to => 'partials/layout/_layout.scss'
15
+ file '../shared/_ie-layout.scss', :like => :stylesheet, :to => 'partials/layout/_ie-layout.scss'
16
+ file '../shared/_print-layout.scss', :like => :stylesheet, :to => 'partials/layout/_print-layout.scss'
17
17
 
18
- stylesheet 'partials/design/_design.scss'
19
- stylesheet 'partials/design/_ie-design.scss'
20
- stylesheet 'partials/design/_print-design.scss'
18
+ file '../shared/_design.scss', :like => :stylesheet, :to => 'partials/design/_design.scss'
19
+ file '../shared/_ie-design.scss', :like => :stylesheet, :to => 'partials/design/_ie-design.scss'
20
+ file '../shared/_print-design.scss', :like => :stylesheet, :to => 'partials/design/_print-design.scss'
21
21
 
22
- stylesheet 'print.scss', :media => 'print'
23
- stylesheet 'ie.scss', :media => 'screen, projection', :condition => "lt IE 8"
22
+ file '../shared/print.scss', :like => :stylesheet, :media => 'print', :to => 'print.scss'
23
+ file '../shared/ie.scss', :like => :stylesheet, :media => 'screen, projection', :condition => "lt IE 8", :to => 'ie.scss'
24
24
 
25
- # JavaScript and Images
26
- discover :javascripts
25
+ # JavaScript
26
+ file '../shared/hammer.js', :like => :javascript, :to => 'hammer.js'
27
+ file '../shared/loader.js', :like => :javascript, :to => 'loader.js'
28
+ file '../shared/modernizr-2.5.3.js', :like => :javascript, :to => 'modernizr-2.5.3.js'
27
29
 
28
30
  help %Q{
29
31
  Please contact Sam Richard or Mason Wendell with questions:
@@ -41,13 +43,13 @@ welcome_message %Q{
41
43
  The following is included in this build:
42
44
  Compass Extensions:
43
45
  * Susy
44
- * Respond-To
46
+ * Toolkit
47
+ * Respond-to
45
48
 
46
49
  JavaScript:
47
50
  * Modernizr Custom Build with all Standard features of 2.3.5 except html5shiv w/printshiv or Media Queries. Build your own from http://modernizr.com/download/ when you are ready for production
48
51
  * Loader.js custom JavaScript file for holding conditional asset loading scripts thanks to Modernizr's yepnope (http://yepnopejs.com/). Comes with yepnope code for loading in Hammer.js, just make sure the path is correct from root.. Ready for production, but remember to minify and gzip!
49
52
  * Hammer.js (http://eightmedia.github.com/hammer.js/) for awesome touch events. Ready for production, but remember to minify and gzip!
50
- * embeds.respond.js is an fluid iFrame solution for YouTube and Vimeo embeds that requires jQuery (for the time being, not included).
51
53
 
52
54
  Include the following in your <head> tag:
53
55
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -5,7 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- version: "0.1"
8
+ - 6
9
+ version: 0.1.6
9
10
  platform: ruby
10
11
  authors:
11
12
  - Sam Richard
@@ -75,47 +76,28 @@ files:
75
76
  - stylesheets/_toolkit.scss
76
77
  - stylesheets/toolkit/_border-box.scss
77
78
  - stylesheets/toolkit/_fluid-media.scss
78
- - stylesheets/toolkit/_progressive-enhancement.scss
79
- - templates/project/embeds.respond.js
80
- - templates/project/hammer.js
81
- - templates/project/ie.scss
82
- - templates/project/loader.js
79
+ - stylesheets/toolkit/_pe.scss
80
+ - templates/project/_base.scss
83
81
  - templates/project/manifest.rb
84
- - templates/project/modernizr-2.5.3.js
85
- - templates/project/partials/design/_design.scss
86
- - templates/project/partials/design/_ie-design.scss
87
- - templates/project/partials/design/_print-design.scss
88
- - templates/project/partials/global/_base.scss
89
- - templates/project/partials/global/_extendables.scss
90
- - templates/project/partials/global/_functions.scss
91
- - templates/project/partials/global/_mixins.scss
92
- - templates/project/partials/global/_variables.scss
93
- - templates/project/partials/layout/_ie-layout.scss
94
- - templates/project/partials/layout/_layout.scss
95
- - templates/project/partials/layout/_print-layout.scss
96
- - templates/project/partials/styleguide/_style-guide.scss
97
- - templates/project/print.scss
98
- - templates/project/style.scss
99
- - templates/respond-to/embeds.respond.js
100
- - templates/respond-to/hammer.js
101
- - templates/respond-to/ie.scss
102
- - templates/respond-to/loader.js
82
+ - templates/respond-to/_base.scss
103
83
  - templates/respond-to/manifest.rb
104
- - templates/respond-to/modernizr-2.5.3.js
105
- - templates/respond-to/partials/design/_design.scss
106
- - templates/respond-to/partials/design/_ie-design.scss
107
- - templates/respond-to/partials/design/_print-design.scss
108
- - templates/respond-to/partials/global/_base.scss
109
- - templates/respond-to/partials/global/_extendables.scss
110
- - templates/respond-to/partials/global/_functions.scss
111
- - templates/respond-to/partials/global/_mixins.scss
112
- - templates/respond-to/partials/global/_variables.scss
113
- - templates/respond-to/partials/layout/_ie-layout.scss
114
- - templates/respond-to/partials/layout/_layout.scss
115
- - templates/respond-to/partials/layout/_print-layout.scss
116
- - templates/respond-to/partials/styleguide/_style-guide.scss
117
- - templates/respond-to/print.scss
118
- - templates/respond-to/style.scss
84
+ - templates/shared/_design.scss
85
+ - templates/shared/_extendables.scss
86
+ - templates/shared/_functions.scss
87
+ - templates/shared/_ie-design.scss
88
+ - templates/shared/_ie-layout.scss
89
+ - templates/shared/_layout.scss
90
+ - templates/shared/_mixins.scss
91
+ - templates/shared/_print-design.scss
92
+ - templates/shared/_print-layout.scss
93
+ - templates/shared/_style-guide.scss
94
+ - templates/shared/_variables.scss
95
+ - templates/shared/hammer.js
96
+ - templates/shared/ie.scss
97
+ - templates/shared/loader.js
98
+ - templates/shared/modernizr-2.5.3.js
99
+ - templates/shared/print.scss
100
+ - templates/shared/style.scss
119
101
  has_rdoc: true
120
102
  homepage: https://github.com/Snugug/toolkit
121
103
  licenses: []
@@ -1,57 +0,0 @@
1
- ////////////////////////
2
- // Enhance From
3
- //
4
- // - $feature: Modernizr feature (base CSS class name)
5
- ////////////////////////
6
- @mixin enhance-with($feature) {
7
- .#{$feature} & {
8
- @content;
9
- }
10
- }
11
-
12
- ////////////////////////
13
- // Degrade From
14
- //
15
- // - $feature: Modernizr feature (base CSS class name)
16
- ////////////////////////
17
- @mixin degrade-from($feature) {
18
- .no-#{$feature} &,
19
- .no-js & {
20
- @content;
21
- }
22
- }
23
-
24
- ////////////////////////
25
- // Progressive Enhancement Text Replace Mixin
26
- //
27
- // - $image-name: Name of the image file without extension.
28
- // - $path-from-images: The path from your images folder where the .png and .svg are stored. They should be stored in the same folder.
29
- // - $sprite-name: The name of the folder your files are stored in in order to name the sprite. See Compass Image Spriting for more info.
30
- // - $inline: Whether or not the parent item is an inline item. If the item is inline, squish-text() needs to be used. Defaults to false.
31
- ////////////////////////
32
- @mixin replace-text-pe($image-name, $path-from-images, $sprite-name, $inline: false) {
33
- // Put the height/width of the image in
34
- height: image-height('#{$path-from-images}/#{$image-name}.png');
35
- width: image-width('#{$path-from-images}/#{$image-name}.png');
36
- // Hide text. Use squish-text() if the element is inline
37
- @if $inline {
38
- @include squish-text();
39
- }
40
- @else {
41
- @include hide-text();
42
- }
43
- // No repeating backgrounds, please.
44
- background-repeat: no-repeat;
45
-
46
- @include enhance-with('svg') {
47
- // Inline the SVG so that advanced browsers and future tech doesn't need the extra HTTP requests for the SVG
48
- background-image: inline-image('#{$path-from-images}/#{$image-name}.svg');
49
- // Set background size to ensure that our SVG is the right size.
50
- background-size: image-width('#{$path-from-images}/#{$image-name}.png') image-height('#{$path-from-images}/#{$image-name}.png');
51
- }
52
-
53
- @include degrade-from('svg') {
54
- // Call the Sprite'd image's position.
55
- @include #{$sprite-name}-sprite(#{$image-name});
56
- }
57
- }
@@ -1,37 +0,0 @@
1
- jQuery(document).ready(function($) {
2
- // Find all YouTube videos
3
- var $allVideos = $("iframe[src^='http://player.vimeo.com'], iframe[src^='http://www.youtube.com']");
4
-
5
- // The element that is fluid width
6
- $fluidEl = $("#content");
7
-
8
- // Figure out and save aspect ratio for each video
9
- $allVideos.each(function() {
10
-
11
- $(this)
12
- .data('aspectRatio', this.height / this.width)
13
-
14
- // and remove the hard coded width/height
15
- .removeAttr('height')
16
- .removeAttr('width');
17
-
18
- });
19
-
20
- // When the window is resized
21
- $(window).resize(function() {
22
-
23
- var newWidth = $fluidEl.width();
24
-
25
- // Resize all videos according to their own aspect ratio
26
- $allVideos.each(function() {
27
-
28
- var $el = $(this);
29
- $el
30
- .width(newWidth)
31
- .height(newWidth * $el.data('aspectRatio'));
32
-
33
- });
34
-
35
- // Kick off one resize to fix all videos on page load
36
- }).resize();
37
- });
@@ -1,37 +0,0 @@
1
- jQuery(document).ready(function($) {
2
- // Find all YouTube videos
3
- var $allVideos = $("iframe[src^='http://player.vimeo.com'], iframe[src^='http://www.youtube.com']");
4
-
5
- // The element that is fluid width
6
- $fluidEl = $("#content");
7
-
8
- // Figure out and save aspect ratio for each video
9
- $allVideos.each(function() {
10
-
11
- $(this)
12
- .data('aspectRatio', this.height / this.width)
13
-
14
- // and remove the hard coded width/height
15
- .removeAttr('height')
16
- .removeAttr('width');
17
-
18
- });
19
-
20
- // When the window is resized
21
- $(window).resize(function() {
22
-
23
- var newWidth = $fluidEl.width();
24
-
25
- // Resize all videos according to their own aspect ratio
26
- $allVideos.each(function() {
27
-
28
- var $el = $(this);
29
- $el
30
- .width(newWidth)
31
- .height(newWidth * $el.data('aspectRatio'));
32
-
33
- });
34
-
35
- // Kick off one resize to fix all videos on page load
36
- }).resize();
37
- });