foundation-sass 2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/README.mkdn +70 -0
  2. data/lib/foundation-sass.rb +9 -0
  3. data/stylesheets/_foundation-sass.sass +1 -0
  4. data/templates/project/MIT-LICENSE.txt +20 -0
  5. data/templates/project/config.rb +33 -0
  6. data/templates/project/humans.txt +8 -0
  7. data/templates/project/images/misc/button-gloss.png +0 -0
  8. data/templates/project/images/misc/button-overlay.png +0 -0
  9. data/templates/project/images/misc/custom-form-sprites.png +0 -0
  10. data/templates/project/images/misc/input-bg.png +0 -0
  11. data/templates/project/images/misc/modal-gloss.png +0 -0
  12. data/templates/project/images/misc/table-sorter.png +0 -0
  13. data/templates/project/images/orbit/bullets.jpg +0 -0
  14. data/templates/project/images/orbit/left-arrow.png +0 -0
  15. data/templates/project/images/orbit/loading.gif +0 -0
  16. data/templates/project/images/orbit/mask-black.png +0 -0
  17. data/templates/project/images/orbit/pause-black.png +0 -0
  18. data/templates/project/images/orbit/right-arrow.png +0 -0
  19. data/templates/project/images/orbit/rotator-black.png +0 -0
  20. data/templates/project/images/orbit/timer-black.png +0 -0
  21. data/templates/project/index.html +151 -0
  22. data/templates/project/javascripts/app.js +43 -0
  23. data/templates/project/javascripts/forms.jquery.js +58 -0
  24. data/templates/project/javascripts/jquery.customforms.js +168 -0
  25. data/templates/project/javascripts/jquery.min.js +4 -0
  26. data/templates/project/javascripts/jquery.orbit-1.3.0.js +597 -0
  27. data/templates/project/javascripts/jquery.placeholder.min.js +2 -0
  28. data/templates/project/javascripts/jquery.reveal.js +126 -0
  29. data/templates/project/manifest.rb +75 -0
  30. data/templates/project/robots.txt +4 -0
  31. data/templates/project/sass/app.sass +6 -0
  32. data/templates/project/sass/forms.sass +189 -0
  33. data/templates/project/sass/globals.sass +128 -0
  34. data/templates/project/sass/grid.sass +159 -0
  35. data/templates/project/sass/ie.sass +11 -0
  36. data/templates/project/sass/includes/_colors.sass +8 -0
  37. data/templates/project/sass/includes/_mixins.sass +32 -0
  38. data/templates/project/sass/includes/_settings.sass +5 -0
  39. data/templates/project/sass/mobile.sass +215 -0
  40. data/templates/project/sass/orbit.sass +156 -0
  41. data/templates/project/sass/reveal.sass +86 -0
  42. data/templates/project/sass/typography.sass +130 -0
  43. data/templates/project/sass/ui.sass +331 -0
  44. data/templates/project/stylesheets/app.css +1 -0
  45. data/templates/project/stylesheets/forms.css +70 -0
  46. data/templates/project/stylesheets/globals.css +69 -0
  47. data/templates/project/stylesheets/grid.css +66 -0
  48. data/templates/project/stylesheets/ie.css +2 -0
  49. data/templates/project/stylesheets/mobile.css +76 -0
  50. data/templates/project/stylesheets/orbit.css +45 -0
  51. data/templates/project/stylesheets/reveal.css +24 -0
  52. data/templates/project/stylesheets/typography.css +57 -0
  53. data/templates/project/stylesheets/ui.css +110 -0
  54. metadata +109 -0
data/README.mkdn ADDED
@@ -0,0 +1,70 @@
1
+ Sass Foundation
2
+ =====================
3
+
4
+ To create your first project, navigate to the foundation-sass folder in terminal and install the gem. You'll also need to make sure Compass is installed.
5
+
6
+ In Terminal:
7
+ * sudo gem install compass
8
+
9
+ Next you'll create your first project.
10
+
11
+ In Terminal:
12
+ * cd path/to/where-you-want-new-project
13
+ * compass create my_project -r foundation-sass --using foundation-sass --force
14
+
15
+ Now you should have a new project folder created with the foundation file structure, but with the awesome advantages of having all the css pre-processed with Sass.
16
+
17
+ ===============================
18
+
19
+ Welcome to Foundation
20
+ =====================
21
+
22
+ Foundation is a rock-solid, responsive framework for rapidly prototyping and iterating into production code. It includes a 12-column, future-friendly grid and tons of great tools and elements that'll get you up and running in no time. Clone the repo to get the marketing site, docs, and base source. You can also visit http://foundation.zurb.com to download just the base source as a starting boilerplate.
23
+
24
+ Homepage: http://foundation.zurb.com
25
+ Documentation: http://foundation.zurb.com/docs
26
+ Download: http://foundation.zurb.com/files/foundation-download.zip
27
+
28
+ Foundation is MIT-licensed and absolutely free to use. Foundation wouldn't be possible without the support of the entire ZURB team, our friends and colleagues who gave feedback, and some luminaries who did some heavy lifting that we took advantage of (thanks guys).
29
+
30
+ Repo Contents
31
+ =============
32
+
33
+ * README
34
+ * IMAGES - Base images for Orbit and some standard elements
35
+ * INCLUDES - Header and footer (currently PHP)
36
+ * index.php
37
+ * JAVASCRIPTS - jQuery, app.js placeholder, placeholder
38
+ * MARKETING - the entire marketing site (foundation.zurb.com)
39
+ * robots.txt - Boilerplate robots file
40
+ * STYLESHEETS - the Foundation stylesheets
41
+
42
+ ZURB
43
+ ====
44
+
45
+ Foundation was made by [ZURB](http://www.zurb.com), an interaction design and design strategy firm in Campbell, CA.
46
+
47
+ If Foundation knocks your socks off the way we hope it does and you want more, why not check out [our jobs](http://www.zurb.com/talent/jobs)?
48
+
49
+ Community
50
+ =========
51
+
52
+ Many thanks to all the people working on implementations of Foundation for their favorite framework. If want to get on this list send an email to foundation@zurb.com.
53
+
54
+ WordPress
55
+
56
+ * [Starter Theme](https://github.com/drewsymo/Foundation) by Drew Morris
57
+ * [Optional install for roots](https://github.com/retlehs/roots) by Corey Wagehoft
58
+
59
+ .NET
60
+
61
+ * [NuGet Package for ASP.Net MVC](http://nuget.org/List/Packages/Zurb_Foundation_MPC3) by Edward Charbeneau
62
+
63
+ MIT Open Source License
64
+ =======================
65
+
66
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
69
+
70
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,9 @@
1
+ require 'compass'
2
+ Compass::Frameworks.register("foundation-sass", :path => "#{File.dirname(__FILE__)}/..")
3
+
4
+ module FoundationSass
5
+
6
+ VERSION = "2.1"
7
+ DATE = "2011-11-18"
8
+
9
+ end
@@ -0,0 +1 @@
1
+ // Compass extension
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 ZURB, http://www.zurb.com/
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # Compass Configuration
2
+
3
+ # Required compass extenstions
4
+ require 'foundation-sass'
5
+
6
+ # HTTP paths
7
+ http_path = '/'
8
+ http_stylesheets_path = '/stylesheets'
9
+ http_images_path = '/images'
10
+ http_javascripts_path = '/javascripts'
11
+
12
+ # File system locations
13
+ sass_dir = 'sass'
14
+ css_dir = 'stylesheets'
15
+ images_dir = 'images'
16
+ javascripts_dir = 'javascripts'
17
+
18
+ # Set to true for debugging
19
+ line_comments = false
20
+
21
+ # What syntax do we prefer?
22
+ preferred_syntax = :sass
23
+
24
+ # CSS output style, :nested, :expanded, :compact, or :compressed
25
+ output_style = :compact
26
+
27
+ # True or false, Compass asset helper functions generates relative paths
28
+ relative_assets = true
29
+
30
+ # Sass options
31
+ sass_options = { :cache => 'false' }
32
+
33
+ # Learn more: http://compass-style.org/docs/tutorials/configuration-reference/
@@ -0,0 +1,8 @@
1
+ /* Foundation was made by ZURB, an interaction design and design strategy firm in Campbell, CA */
2
+ /* zurb.com */
3
+ /* humanstxt.org */
4
+
5
+ /* SITE */
6
+ Standards: HTML5, CSS3
7
+ Components: jQuery, Orbit, Reveal
8
+ Software: Coda, TextMate, Git
@@ -0,0 +1,151 @@
1
+ <!DOCTYPE html>
2
+
3
+ <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
4
+ <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
5
+ <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
6
+ <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
7
+ <!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
8
+ <head>
9
+ <meta charset="utf-8" />
10
+
11
+ <!-- Set the viewport width to device width for mobile -->
12
+ <meta name="viewport" content="width=device-width" />
13
+
14
+ <title>Welcome to Foundation</title>
15
+
16
+ <!-- Included CSS Files -->
17
+ <!-- Combine and Compress These CSS Files -->
18
+ <link rel="stylesheet" href="stylesheets/globals.css">
19
+ <link rel="stylesheet" href="stylesheets/typography.css">
20
+ <link rel="stylesheet" href="stylesheets/grid.css">
21
+ <link rel="stylesheet" href="stylesheets/ui.css">
22
+ <link rel="stylesheet" href="stylesheets/forms.css">
23
+ <link rel="stylesheet" href="stylesheets/orbit.css">
24
+ <link rel="stylesheet" href="stylesheets/reveal.css">
25
+ <link rel="stylesheet" href="stylesheets/mobile.css">
26
+ <!-- End Combine and Compress These CSS Files -->
27
+ <link rel="stylesheet" href="stylesheets/app.css">
28
+
29
+ <!--[if lt IE 9]>
30
+ <link rel="stylesheet" href="stylesheets/ie.css">
31
+ <![endif]-->
32
+
33
+
34
+ <!-- IE Fix for HTML5 Tags -->
35
+ <!--[if lt IE 9]>
36
+ <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
37
+ <![endif]-->
38
+
39
+ </head>
40
+ <body>
41
+
42
+ <!-- container -->
43
+ <div class="container">
44
+
45
+ <div class="row">
46
+ <div class="twelve columns">
47
+ <h2>Welcome to Foundation</h2>
48
+ <p>This is version 2.0.3 released on October 31, 2011</p>
49
+
50
+ <hr />
51
+ </div>
52
+ </div>
53
+
54
+ <div class="row">
55
+ <div class="eight columns">
56
+ <h3>The Grid</h3>
57
+
58
+ <!-- Grid Example -->
59
+ <div class="row">
60
+ <div class="twelve columns">
61
+ <div class="panel">
62
+ <p>This is a twelve column section in a row. Each of these includes a div.panel element so you can see where the columns are - it's not required at all for the grid.</p>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ <div class="row">
67
+ <div class="six columns">
68
+ <div class="panel">
69
+ <p>Six columns</p>
70
+ </div>
71
+ </div>
72
+ <div class="six columns">
73
+ <div class="panel">
74
+ <p>Six columns</p>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ <div class="row">
79
+ <div class="four columns">
80
+ <div class="panel">
81
+ <p>Four columns</p>
82
+ </div>
83
+ </div>
84
+ <div class="four columns">
85
+ <div class="panel">
86
+ <p>Four columns</p>
87
+ </div>
88
+ </div>
89
+ <div class="four columns">
90
+ <div class="panel">
91
+ <p>Four columns</p>
92
+ </div>
93
+ </div>
94
+ </div>
95
+
96
+ <h3>Tabs</h3>
97
+ <dl class="tabs">
98
+ <dd><a href="#simple1" class="active">Simple Tab 1</a></dd>
99
+ <dd><a href="#simple2">Simple Tab 2</a></dd>
100
+ <dd><a href="#simple3">Simple Tab 3</a></dd>
101
+ </dl>
102
+
103
+ <ul class="tabs-content">
104
+ <li class="active" id="simple1Tab">This is simple tab 1's content. Pretty neat, huh?</li>
105
+ <li id="simple2Tab">This is simple tab 2's content. Now you see it!</li>
106
+ <li id="simple3Tab">This is simple tab 3's content. It's, you know...okay.</li>
107
+ </ul>
108
+
109
+ <h3>Buttons</h3>
110
+
111
+ <p><a href="#" class="small blue button">Small Blue Button</a></p>
112
+ <p><a href="#" class="blue button">Medium Blue Button</a></p>
113
+ <p><a href="#" class="large blue button">Large Blue Button</a></p>
114
+
115
+ <p><a href="#" class="nice radius small blue button">Nice Blue Button</a></p>
116
+ <p><a href="#" class="nice radius blue button">Nice Blue Button</a></p>
117
+ <p><a href="#" class="nice radius large blue button">Nice Blue Button</a></p>
118
+
119
+ </div>
120
+
121
+ <div class="four columns">
122
+ <h4>Getting Started</h4>
123
+ <p>We're stoked you want to try Foundation! To get going, this file (index.html) includes some basic styles you can modify, play around with, or totally destroy to get going.</p>
124
+
125
+ <h4>Other Resources</h4>
126
+ <p>Once you've exhausted the fun in this document, you should check out:</p>
127
+ <ul class="disc">
128
+ <li><a href="http://foundation.zurb.com/docs">Foundation Documentation</a><br />Everything you need to know about using the framework.</li>
129
+ <li><a href="http://github.com/zurb/foundation">Foundation on Github</a><br />Latest code, issue reports, feature requests and more.</li>
130
+ <li><a href="http://twitter.com/foundationzurb">@foundationzurb</a><br />Ping us on Twitter if you have questions. If you build something with this we'd love to see it (and send you a totally boss sticker).</li>
131
+ </ul>
132
+ </div>
133
+ </div>
134
+
135
+ </div>
136
+ <!-- container -->
137
+
138
+
139
+
140
+
141
+ <!-- Included JS Files -->
142
+ <script src="javascripts/jquery.min.js"></script>
143
+ <script src="javascripts/jquery.reveal.js"></script>
144
+ <script src="javascripts/jquery.orbit-1.3.0.js"></script>
145
+ <script src="javascripts/forms.jquery.js"></script>
146
+ <script src="javascripts/jquery.customforms.js"></script>
147
+ <script src="javascripts/jquery.placeholder.min.js"></script>
148
+ <script src="javascripts/app.js"></script>
149
+
150
+ </body>
151
+ </html>
@@ -0,0 +1,43 @@
1
+ $(document).ready(function() {
2
+
3
+ /* Use this js doc for all application specific JS */
4
+
5
+ /* TABS --------------------------------- */
6
+ /* Remove if you don't need :) */
7
+
8
+ var tabs = $('dl.tabs');
9
+ tabsContent = $('ul.tabs-content')
10
+
11
+ tabs.each(function(i) {
12
+ //Get all tabs
13
+ var tab = $(this).children('dd').children('a');
14
+ tab.click(function(e) {
15
+
16
+ //Get Location of tab's content
17
+ var contentLocation = $(this).attr("href")
18
+ contentLocation = contentLocation + "Tab";
19
+
20
+ //Let go if not a hashed one
21
+ if(contentLocation.charAt(0)=="#") {
22
+
23
+ e.preventDefault();
24
+
25
+ //Make Tab Active
26
+ tab.removeClass('active');
27
+ $(this).addClass('active');
28
+
29
+ //Show Tab Content
30
+ $(contentLocation).parent('.tabs-content').children('li').css({"display":"none"});
31
+ $(contentLocation).css({"display":"block"});
32
+
33
+ }
34
+ });
35
+ });
36
+
37
+
38
+ /* PLACEHOLDER FOR FORMS ------------- */
39
+ /* Remove this and jquery.placeholder.min.js if you don't need :) */
40
+
41
+ $('input, textarea').placeholder();
42
+
43
+ });
@@ -0,0 +1,58 @@
1
+ /**
2
+ * jQuery.placeholder - Placeholder plugin for input fields
3
+ * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
4
+ * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
5
+ * Date: 2008/10/14
6
+ *
7
+ * @author Blair Mitchelmore
8
+ * @version 1.0.1
9
+ *
10
+ **/
11
+ new function($) {
12
+ $.fn.placeholder = function(settings) {
13
+ settings = settings || {};
14
+ var key = settings.dataKey || "placeholderValue";
15
+ var attr = settings.attr || "placeholder";
16
+ var className = settings.className || "placeholder";
17
+ var values = settings.values || [];
18
+ var block = settings.blockSubmit || false;
19
+ var blank = settings.blankSubmit || false;
20
+ var submit = settings.onSubmit || false;
21
+ var value = settings.value || "";
22
+ var position = settings.cursor_position || 0;
23
+
24
+
25
+ return this.filter(":input").each(function(index) {
26
+ $.data(this, key, values[index] || $(this).attr(attr));
27
+ }).each(function() {
28
+ if ($.trim($(this).val()) === "")
29
+ $(this).addClass(className).val($.data(this, key));
30
+ }).focus(function() {
31
+ if ($.trim($(this).val()) === $.data(this, key))
32
+ $(this).removeClass(className).val(value)
33
+ if ($.fn.setCursorPosition) {
34
+ $(this).setCursorPosition(position);
35
+ }
36
+ }).blur(function() {
37
+ if ($.trim($(this).val()) === value)
38
+ $(this).addClass(className).val($.data(this, key));
39
+ }).each(function(index, elem) {
40
+ if (block)
41
+ new function(e) {
42
+ $(e.form).submit(function() {
43
+ return $.trim($(e).val()) != $.data(e, key)
44
+ });
45
+ }(elem);
46
+ else if (blank)
47
+ new function(e) {
48
+ $(e.form).submit(function() {
49
+ if ($.trim($(e).val()) == $.data(e, key))
50
+ $(e).removeClass(className).val("");
51
+ return true;
52
+ });
53
+ }(elem);
54
+ else if (submit)
55
+ new function(e) { $(e.form).submit(submit); }(elem);
56
+ });
57
+ };
58
+ }(jQuery);
@@ -0,0 +1,168 @@
1
+ /*
2
+ * jQuery Custom Forms Plugin 1.0
3
+ * www.ZURB.com
4
+ * Copyright 2010, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+
9
+ jQuery(document).ready(function ($) {
10
+
11
+ function appendCustomMarkup(type) {
12
+ $('form.custom input:' + type).each(function () {
13
+ var $span = $('<span class="custom ' + type + '"></span>');
14
+ if ($(this).next('span.custom.' + type).length === 0) {
15
+ if (this.checked) {
16
+ $span.addClass('checked');
17
+ }
18
+ $(this)
19
+ .hide()
20
+ .after($span);
21
+ }
22
+ });
23
+ }
24
+ appendCustomMarkup('checkbox');
25
+ appendCustomMarkup('radio');
26
+
27
+ $('form.custom select').each(function () {
28
+ var $this = $(this),
29
+ $customSelect = $this.next('div.custom.dropdown'),
30
+ $options = $this.find('option'),
31
+ maxWidth = 0,
32
+ $li;
33
+
34
+ if ($customSelect.length === 0) {
35
+ $customSelect = $('<div class="custom dropdown"><a href="#" class="selector"></a><ul></ul></div>"');
36
+ $options.each(function () {
37
+ $li = $('<li>' + $(this).html() + '</li>');
38
+ $customSelect.find('ul').append($li);
39
+ });
40
+ $customSelect.prepend('<a href="#" class="current">' + $options.first().html() + '</a>');
41
+
42
+ $this.after($customSelect);
43
+ $this.hide();
44
+ }
45
+
46
+ $options.each(function (index) {
47
+ if (this.selected) {
48
+ $customSelect.find('li').eq(index).addClass('selected');
49
+ $customSelect.find('.current').html($(this).html());
50
+ }
51
+ });
52
+
53
+ $customSelect.find('li').each(function () {
54
+ $customSelect.addClass('open');
55
+ if ($(this).outerWidth() > maxWidth) {
56
+ maxWidth = $(this).outerWidth();
57
+ }
58
+ $customSelect.removeClass('open');
59
+ });
60
+ $customSelect.css('width', maxWidth + 18 + 'px');
61
+ $customSelect.find('ul').css('width', maxWidth + 16 + 'px');
62
+ });
63
+ });
64
+
65
+ (function ($) {
66
+
67
+ function toggleCheckbox($element) {
68
+ var $input = $element.prev(),
69
+ input = $input[0];
70
+
71
+ input.checked = ((input.checked) ? false : true);
72
+ $element.toggleClass('checked');
73
+
74
+ $input.trigger('change');
75
+ }
76
+
77
+ function toggleRadio($element) {
78
+ var $input = $element.prev(),
79
+ input = $input[0];
80
+
81
+ $('input:radio[name=' + $input.attr('name') + ']').each(function () {
82
+ $(this).next().removeClass('checked');
83
+ });
84
+ input.checked = ((input.checked) ? false : true);
85
+ $element.toggleClass('checked');
86
+
87
+ $input.trigger('change');
88
+ }
89
+
90
+ $('form.custom span.custom.checkbox').live('click', function (event) {
91
+ event.preventDefault();
92
+ event.stopPropagation();
93
+
94
+ toggleCheckbox($(this));
95
+ });
96
+
97
+ $('form.custom span.custom.radio').live('click', function (event) {
98
+ event.preventDefault();
99
+ event.stopPropagation();
100
+
101
+ toggleRadio($(this));
102
+ });
103
+
104
+ $('form.custom label').live('click', function (event) {
105
+ var $associatedElement = $('#' + $(this).attr('for')),
106
+ $customCheckbox,
107
+ $customRadio;
108
+ if ($associatedElement.length !== 0) {
109
+ if ($associatedElement.attr('type') === 'checkbox') {
110
+ event.preventDefault();
111
+ $customCheckbox = $(this).find('span.custom.checkbox');
112
+ toggleCheckbox($customCheckbox);
113
+ } else if ($associatedElement.attr('type') === 'radio') {
114
+ event.preventDefault();
115
+ $customRadio = $(this).find('span.custom.radio');
116
+ toggleRadio($customRadio);
117
+ }
118
+ }
119
+ });
120
+
121
+ $('form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector').live('click', function (event) {
122
+ var $this = $(this),
123
+ $dropdown = $this.closest('div.custom.dropdown');
124
+
125
+ event.preventDefault();
126
+ $dropdown.toggleClass('open');
127
+
128
+ if ($dropdown.hasClass('open')) {
129
+ $(document).bind('click.customdropdown', function (event) {
130
+ $dropdown.removeClass('open');
131
+ $(document).unbind('.customdropdown');
132
+ });
133
+ } else {
134
+ $(document).unbind('.customdropdown');
135
+ }
136
+ });
137
+
138
+ $('form.custom div.custom.dropdown li').live('click', function (event) {
139
+ var $this = $(this),
140
+ $customDropdown = $this.closest('div.custom.dropdown'),
141
+ $select = $customDropdown.prev(),
142
+ selectedIndex = 0;
143
+
144
+ event.preventDefault();
145
+ event.stopPropagation();
146
+
147
+ $this
148
+ .closest('ul')
149
+ .find('li')
150
+ .removeClass('selected');
151
+ $this.addClass('selected');
152
+
153
+ $customDropdown
154
+ .removeClass('open')
155
+ .find('a.current')
156
+ .html($this.html());
157
+
158
+ $this.closest('ul').find('li').each(function (index) {
159
+ if ($this[0] == this) {
160
+ selectedIndex = index;
161
+ }
162
+
163
+ });
164
+ $select[0].selectedIndex = selectedIndex;
165
+
166
+ $select.trigger('change');
167
+ });
168
+ })(jQuery);