better_styles 0.0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +33 -0
- data/Rakefile +34 -0
- data/app/helpers/styles_helper.rb +33 -0
- data/assets/fonts/betterfonts/betterwork-icons.eot +0 -0
- data/assets/fonts/betterfonts/betterwork-icons.svg +368 -0
- data/assets/fonts/betterfonts/betterwork-icons.ttf +0 -0
- data/assets/fonts/betterfonts/betterwork-icons.woff +0 -0
- data/assets/fonts/betterfonts/icomoon.eot +0 -0
- data/assets/fonts/betterfonts/icomoon.svg +461 -0
- data/assets/fonts/betterfonts/icomoon.ttf +0 -0
- data/assets/fonts/betterfonts/icomoon.woff +0 -0
- data/assets/fonts/betterfonts/magicons-regular-webfont.eot +0 -0
- data/assets/fonts/betterfonts/magicons-regular-webfont.svg +461 -0
- data/assets/fonts/betterfonts/magicons-regular-webfont.ttf +0 -0
- data/assets/fonts/betterfonts/magicons-regular-webfont.woff +0 -0
- data/assets/fonts/betterfonts/newmagicons-regular-webfont.eot +0 -0
- data/assets/fonts/betterfonts/newmagicons-regular-webfont.svg +199 -0
- data/assets/fonts/betterfonts/newmagicons-regular-webfont.ttf +0 -0
- data/assets/fonts/betterfonts/newmagicons-regular-webfont.woff +0 -0
- data/assets/fonts/betterfonts/orderlifticons-webfont.eot +0 -0
- data/assets/fonts/betterfonts/orderlifticons-webfont.svg +172 -0
- data/assets/fonts/betterfonts/orderlifticons-webfont.ttf +0 -0
- data/assets/fonts/betterfonts/orderlifticons-webfont.woff +0 -0
- data/assets/images/better/arrows/arrow-round1-a.png +0 -0
- data/assets/images/better/arrows/arrow-round1-b.png +0 -0
- data/assets/images/better/arrows/arrow-round2-a.png +0 -0
- data/assets/images/better/arrows/arrow-round2-b.png +0 -0
- data/assets/images/better/arrows/arrow1-a.png +0 -0
- data/assets/images/better/arrows/arrow1-b.png +0 -0
- data/assets/images/better/arrows/arrow1.png +0 -0
- data/assets/images/better/arrows/arrow2-1.png +0 -0
- data/assets/images/better/arrows/arrow2-2.png +0 -0
- data/assets/images/better/arrows/arrow2-a.png +0 -0
- data/assets/images/better/arrows/arrow2-b.png +0 -0
- data/assets/images/better/arrows/arrow3-a.png +0 -0
- data/assets/images/better/arrows/arrow3-b.png +0 -0
- data/assets/images/better/arrows/arrow4-a.png +0 -0
- data/assets/images/better/arrows/arrow4-b.png +0 -0
- data/assets/images/better/arrows/arrow5-a.png +0 -0
- data/assets/images/better/arrows/arrow5-b.png +0 -0
- data/assets/images/better/arrows/arrow6-a.png +0 -0
- data/assets/images/better/arrows/arrow6-b.png +0 -0
- data/assets/images/better/helper/blank_10.png +0 -0
- data/assets/images/better/helper/crossed.png +0 -0
- data/assets/images/better/helper/white_10.png +0 -0
- data/assets/javascripts/better_styles.js.coffee +4 -0
- data/assets/javascripts/betterjs/forms/check_switch.js.coffee +25 -0
- data/assets/javascripts/betterjs/helper.js.coffee +74 -0
- data/assets/javascripts/betterjs/navigations/aside_link.js.coffee +9 -0
- data/assets/javascripts/betterjs/navigations/nav_list.js.coffee +19 -0
- data/assets/javascripts/betterjs/rails_ext/rails-ujs.js +479 -0
- data/assets/javascripts/betterjs/render_eco.js.coffee +9 -0
- data/assets/javascripts/betterjs/templates/fixed_aside_to_header.js.coffee +6 -0
- data/assets/javascripts/betterjs/templates/icon_aside.js.coffee +12 -0
- data/assets/javascripts/betterjs/templates/scroll_to_fix_aside.js +32 -0
- data/assets/javascripts/betterjs/twbs_ext/affix_2_1_0.js +103 -0
- data/assets/javascripts/betterjs/twbs_ext/affix_3_3_7.js +162 -0
- data/assets/javascripts/betterjs/twbs_ext/affix_ext.js +131 -0
- data/assets/stylesheets/better/content/_box.scss +46 -0
- data/assets/stylesheets/better/content/_buttons.scss +22 -0
- data/assets/stylesheets/better/content/_check_switch.scss +78 -0
- data/assets/stylesheets/better/content/_divider.scss +65 -0
- data/assets/stylesheets/better/content/_helpers.scss +85 -0
- data/assets/stylesheets/better/content/_pix.scss +70 -0
- data/assets/stylesheets/better/content/_typography.scss +44 -0
- data/assets/stylesheets/better/icons/bettericons.scss +419 -0
- data/assets/stylesheets/better/icons/icomoon.scss +1392 -0
- data/assets/stylesheets/better/icons/magicons.scss +705 -0
- data/assets/stylesheets/better/icons/orderlifticons.scss +300 -0
- data/assets/stylesheets/better/layout/_corset.scss +57 -0
- data/assets/stylesheets/better/layout/_fullpage_table.scss +185 -0
- data/assets/stylesheets/better/layout/_positioning.scss +62 -0
- data/assets/stylesheets/better/layout/_section.scss +220 -0
- data/assets/stylesheets/better/lib/_helpers.scss +67 -0
- data/assets/stylesheets/better/lib/_media_querries.scss +43 -0
- data/assets/stylesheets/better/lib/_nav.scss +31 -0
- data/assets/stylesheets/better/lib/_shadows.scss +247 -0
- data/assets/stylesheets/better/lib/_text.scss +66 -0
- data/assets/stylesheets/better/navigations/_aside_lnk.scss +100 -0
- data/assets/stylesheets/better/navigations/_nav_list.scss +177 -0
- data/assets/stylesheets/better/templates/_fixed_aside_to_header.scss +89 -0
- data/assets/stylesheets/better/templates/_icon_aside.scss +404 -0
- data/assets/stylesheets/better/templates/_scroll_to_fix_aside.scss +104 -0
- data/assets/stylesheets/better/variables/_color.scss +87 -0
- data/assets/stylesheets/better/variables/_typography.scss +59 -0
- data/assets/stylesheets/better/variables/_vars.scss +57 -0
- data/assets/stylesheets/better_styles.scss +44 -0
- data/assets/stylesheets/better_styles_min.scss +43 -0
- data/lib/better_styles.rb +64 -0
- data/lib/better_styles/engine.rb +25 -0
- data/lib/better_styles/version.rb +3 -0
- data/lib/tasks/better_styles_tasks.rake +4 -0
- metadata +181 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
$ ->
|
2
|
+
|
3
|
+
$("body").on "click", ".app-logo .toggl", (e) ->
|
4
|
+
e.preventDefault()
|
5
|
+
$("body").toggleClass("with_open_aside")
|
6
|
+
false
|
7
|
+
|
8
|
+
$("body").on "click", ".into-aside-toggl", (e) ->
|
9
|
+
e.preventDefault()
|
10
|
+
$(@).toggleClass("btn-warning")
|
11
|
+
$("body").toggleClass("with_info_aside")
|
12
|
+
false
|
@@ -0,0 +1,32 @@
|
|
1
|
+
//= require betterjs/twbs_ext/affix_2_1_0
|
2
|
+
|
3
|
+
jQuery(function() {
|
4
|
+
|
5
|
+
$('#aside').affix({
|
6
|
+
offset: {
|
7
|
+
top: function () {
|
8
|
+
offset = getInt( $("body").css("padding-top") );
|
9
|
+
return (this.top = $("#aside").offset().top - offset)
|
10
|
+
}
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
$('#aside_toggle').affix({
|
15
|
+
offset: {
|
16
|
+
top: function () {
|
17
|
+
if ( $("body").hasClass("fixed-nav") ) {
|
18
|
+
var neededTop = $("#aside").offset().top - 50;
|
19
|
+
} else {
|
20
|
+
var neededTop = $("#aside").offset().top;
|
21
|
+
}
|
22
|
+
return (this.top = neededTop)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
});
|
26
|
+
|
27
|
+
$("body").on( "click", "#aside_toggle", function(e){
|
28
|
+
e.preventDefault();
|
29
|
+
$('body').toggleClass("with_aside");
|
30
|
+
});
|
31
|
+
|
32
|
+
});
|
@@ -0,0 +1,103 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-affix.js v2.1.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#affix
|
4
|
+
* ==========================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ========================================================== */
|
19
|
+
|
20
|
+
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* AFFIX CLASS DEFINITION
|
27
|
+
* ====================== */
|
28
|
+
|
29
|
+
var Affix = function (element, options) {
|
30
|
+
this.options = $.extend({}, $.fn.affix.defaults, options)
|
31
|
+
this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
|
32
|
+
this.$element = $(element)
|
33
|
+
this.checkPosition()
|
34
|
+
}
|
35
|
+
|
36
|
+
Affix.prototype.checkPosition = function () {
|
37
|
+
if (!this.$element.is(':visible')) return
|
38
|
+
|
39
|
+
var scrollHeight = $(document).height()
|
40
|
+
, scrollTop = this.$window.scrollTop()
|
41
|
+
, position = this.$element.offset()
|
42
|
+
, offset = this.options.offset
|
43
|
+
, offsetBottom = offset.bottom
|
44
|
+
, offsetTop = offset.top
|
45
|
+
, reset = 'affix affix-top affix-bottom'
|
46
|
+
, affix
|
47
|
+
|
48
|
+
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
49
|
+
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
50
|
+
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
|
51
|
+
|
52
|
+
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
|
53
|
+
false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
|
54
|
+
'bottom' : offsetTop != null && scrollTop <= offsetTop ?
|
55
|
+
'top' : false
|
56
|
+
|
57
|
+
if (this.affixed === affix) return
|
58
|
+
|
59
|
+
this.affixed = affix
|
60
|
+
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
|
61
|
+
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
/* AFFIX PLUGIN DEFINITION
|
66
|
+
* ======================= */
|
67
|
+
|
68
|
+
$.fn.affix = function (option) {
|
69
|
+
return this.each(function () {
|
70
|
+
var $this = $(this)
|
71
|
+
, data = $this.data('affix')
|
72
|
+
, options = typeof option == 'object' && option
|
73
|
+
if (!data) $this.data('affix', (data = new Affix(this, options)))
|
74
|
+
if (typeof option == 'string') data[option]()
|
75
|
+
})
|
76
|
+
}
|
77
|
+
|
78
|
+
$.fn.affix.Constructor = Affix
|
79
|
+
|
80
|
+
$.fn.affix.defaults = {
|
81
|
+
offset: 0
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
/* AFFIX DATA-API
|
86
|
+
* ============== */
|
87
|
+
|
88
|
+
$(window).on('load', function () {
|
89
|
+
$('[data-spy="affix"]').each(function () {
|
90
|
+
var $spy = $(this)
|
91
|
+
, data = $spy.data()
|
92
|
+
|
93
|
+
data.offset = data.offset || {}
|
94
|
+
|
95
|
+
data.offsetBottom && (data.offset.bottom = data.offsetBottom)
|
96
|
+
data.offsetTop && (data.offset.top = data.offsetTop)
|
97
|
+
|
98
|
+
$spy.affix(data)
|
99
|
+
})
|
100
|
+
})
|
101
|
+
|
102
|
+
|
103
|
+
}(window.jQuery);
|
@@ -0,0 +1,162 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: affix.js v3.3.7
|
3
|
+
* http://getbootstrap.com/javascript/#affix
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2016 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// AFFIX CLASS DEFINITION
|
14
|
+
// ======================
|
15
|
+
|
16
|
+
var Affix = function (element, options) {
|
17
|
+
this.options = $.extend({}, Affix.DEFAULTS, options)
|
18
|
+
|
19
|
+
this.$target = $(this.options.target)
|
20
|
+
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
21
|
+
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
|
22
|
+
|
23
|
+
this.$element = $(element)
|
24
|
+
this.affixed = null
|
25
|
+
this.unpin = null
|
26
|
+
this.pinnedOffset = null
|
27
|
+
|
28
|
+
this.checkPosition()
|
29
|
+
}
|
30
|
+
|
31
|
+
Affix.VERSION = '3.3.7'
|
32
|
+
|
33
|
+
Affix.RESET = 'affix affix-top affix-bottom'
|
34
|
+
|
35
|
+
Affix.DEFAULTS = {
|
36
|
+
offset: 0,
|
37
|
+
target: window
|
38
|
+
}
|
39
|
+
|
40
|
+
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
|
41
|
+
var scrollTop = this.$target.scrollTop()
|
42
|
+
var position = this.$element.offset()
|
43
|
+
var targetHeight = this.$target.height()
|
44
|
+
|
45
|
+
if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
|
46
|
+
|
47
|
+
if (this.affixed == 'bottom') {
|
48
|
+
if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
|
49
|
+
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
|
50
|
+
}
|
51
|
+
|
52
|
+
var initializing = this.affixed == null
|
53
|
+
var colliderTop = initializing ? scrollTop : position.top
|
54
|
+
var colliderHeight = initializing ? targetHeight : height
|
55
|
+
|
56
|
+
if (offsetTop != null && scrollTop <= offsetTop) return 'top'
|
57
|
+
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
|
58
|
+
|
59
|
+
return false
|
60
|
+
}
|
61
|
+
|
62
|
+
Affix.prototype.getPinnedOffset = function () {
|
63
|
+
if (this.pinnedOffset) return this.pinnedOffset
|
64
|
+
this.$element.removeClass(Affix.RESET).addClass('affix')
|
65
|
+
var scrollTop = this.$target.scrollTop()
|
66
|
+
var position = this.$element.offset()
|
67
|
+
return (this.pinnedOffset = position.top - scrollTop)
|
68
|
+
}
|
69
|
+
|
70
|
+
Affix.prototype.checkPositionWithEventLoop = function () {
|
71
|
+
setTimeout($.proxy(this.checkPosition, this), 1)
|
72
|
+
}
|
73
|
+
|
74
|
+
Affix.prototype.checkPosition = function () {
|
75
|
+
if (!this.$element.is(':visible')) return
|
76
|
+
|
77
|
+
var height = this.$element.height()
|
78
|
+
var offset = this.options.offset
|
79
|
+
var offsetTop = offset.top
|
80
|
+
var offsetBottom = offset.bottom
|
81
|
+
var scrollHeight = Math.max($(document).height(), $(document.body).height())
|
82
|
+
|
83
|
+
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
84
|
+
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
|
85
|
+
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
|
86
|
+
|
87
|
+
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
|
88
|
+
|
89
|
+
if (this.affixed != affix) {
|
90
|
+
if (this.unpin != null) this.$element.css('top', '')
|
91
|
+
|
92
|
+
var affixType = 'affix' + (affix ? '-' + affix : '')
|
93
|
+
var e = $.Event(affixType + '.bs.affix')
|
94
|
+
|
95
|
+
this.$element.trigger(e)
|
96
|
+
|
97
|
+
if (e.isDefaultPrevented()) return
|
98
|
+
|
99
|
+
this.affixed = affix
|
100
|
+
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
|
101
|
+
|
102
|
+
this.$element
|
103
|
+
.removeClass(Affix.RESET)
|
104
|
+
.addClass(affixType)
|
105
|
+
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
|
106
|
+
}
|
107
|
+
|
108
|
+
if (affix == 'bottom') {
|
109
|
+
this.$element.offset({
|
110
|
+
top: scrollHeight - height - offsetBottom
|
111
|
+
})
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
// AFFIX PLUGIN DEFINITION
|
117
|
+
// =======================
|
118
|
+
|
119
|
+
function Plugin(option) {
|
120
|
+
return this.each(function () {
|
121
|
+
var $this = $(this)
|
122
|
+
var data = $this.data('bs.affix')
|
123
|
+
var options = typeof option == 'object' && option
|
124
|
+
|
125
|
+
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
|
126
|
+
if (typeof option == 'string') data[option]()
|
127
|
+
})
|
128
|
+
}
|
129
|
+
|
130
|
+
var old = $.fn.affix
|
131
|
+
|
132
|
+
$.fn.affix = Plugin
|
133
|
+
$.fn.affix.Constructor = Affix
|
134
|
+
|
135
|
+
|
136
|
+
// AFFIX NO CONFLICT
|
137
|
+
// =================
|
138
|
+
|
139
|
+
$.fn.affix.noConflict = function () {
|
140
|
+
$.fn.affix = old
|
141
|
+
return this
|
142
|
+
}
|
143
|
+
|
144
|
+
|
145
|
+
// AFFIX DATA-API
|
146
|
+
// ==============
|
147
|
+
|
148
|
+
$(window).on('load', function () {
|
149
|
+
$('[data-spy="affix"]').each(function () {
|
150
|
+
var $spy = $(this)
|
151
|
+
var data = $spy.data()
|
152
|
+
|
153
|
+
data.offset = data.offset || {}
|
154
|
+
|
155
|
+
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
|
156
|
+
if (data.offsetTop != null) data.offset.top = data.offsetTop
|
157
|
+
|
158
|
+
Plugin.call($spy, data)
|
159
|
+
})
|
160
|
+
})
|
161
|
+
|
162
|
+
}(jQuery);
|
@@ -0,0 +1,131 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-affix.js v2.1.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#affix
|
4
|
+
* ==========================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ========================================================== */
|
19
|
+
|
20
|
+
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* AFFIX CLASS DEFINITION
|
27
|
+
* ====================== */
|
28
|
+
|
29
|
+
var Affix = function (element, options) {
|
30
|
+
this.options = $.extend({}, $.fn.affix.defaults, options)
|
31
|
+
this.$window = $("#body").on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
|
32
|
+
this.$element = $(element)
|
33
|
+
this.checkPosition()
|
34
|
+
}
|
35
|
+
|
36
|
+
Affix.prototype.checkPosition = function () {
|
37
|
+
if (!this.$element.is(':visible')) return
|
38
|
+
|
39
|
+
// console.log( "AFFIX: ", $("#body").scrollTop(), $("#body").width(), this.options )
|
40
|
+
|
41
|
+
var scrollHeight = $("#body").height()
|
42
|
+
, width = $("#body").width()
|
43
|
+
, scrollTop = $("#body").scrollTop()
|
44
|
+
, position = this.$element.offset()
|
45
|
+
, offset = this.options.offset
|
46
|
+
, offsetBottom = offset.bottom
|
47
|
+
, offsetTop = offset.top
|
48
|
+
, reset = 'affix affix-top affix-bottom'
|
49
|
+
, affix
|
50
|
+
|
51
|
+
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
52
|
+
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
53
|
+
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
|
54
|
+
|
55
|
+
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) && (width > 780) ?
|
56
|
+
false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
|
57
|
+
'bottom' : offsetTop != null && scrollTop <= offsetTop ?
|
58
|
+
'top' : false
|
59
|
+
|
60
|
+
if (this.affixed === affix) return
|
61
|
+
|
62
|
+
this.affixed = affix
|
63
|
+
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
|
64
|
+
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
/* AFFIX PLUGIN DEFINITION
|
69
|
+
* ======================= */
|
70
|
+
|
71
|
+
$.fn.affix = function (option) {
|
72
|
+
return this.each(function () {
|
73
|
+
var $this = $(this)
|
74
|
+
, data = $this.data('affix')
|
75
|
+
, options = typeof option == 'object' && option
|
76
|
+
if (!data) $this.data('affix', (data = new Affix(this, options)))
|
77
|
+
if (typeof option == 'string') data[option]()
|
78
|
+
})
|
79
|
+
}
|
80
|
+
|
81
|
+
$.fn.affix.Constructor = Affix
|
82
|
+
|
83
|
+
$.fn.affix.defaults = {
|
84
|
+
offset: 0
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
/* AFFIX DATA-API
|
89
|
+
* ============== */
|
90
|
+
|
91
|
+
$(window).on('load', function () {
|
92
|
+
|
93
|
+
$('[data-spy="affix"]').each(function () {
|
94
|
+
var $spy = $(this)
|
95
|
+
, data = $spy.data()
|
96
|
+
|
97
|
+
data.offset = data.offset || {}
|
98
|
+
|
99
|
+
data.offsetBottom && (data.offset.bottom = data.offsetBottom)
|
100
|
+
data.offsetTop && (data.offset.top = data.offsetTop)
|
101
|
+
|
102
|
+
$spy.affix(data)
|
103
|
+
});
|
104
|
+
|
105
|
+
/*
|
106
|
+
* Clamped-width.
|
107
|
+
* Usage:
|
108
|
+
* <div data-clampedwidth=".myParent">This long content will force clamped width</div>
|
109
|
+
*
|
110
|
+
* Author: LV
|
111
|
+
*/
|
112
|
+
$('[data-clampedwidth]').each(function () {
|
113
|
+
var elem = $(this);
|
114
|
+
// if ( elem.data('clampedwidth') == "true" ) {
|
115
|
+
var parentPanel = elem.parent();
|
116
|
+
// } else {
|
117
|
+
// var parentPanel = elem.data('clampedwidth');
|
118
|
+
// }
|
119
|
+
var resizeFn = function () {
|
120
|
+
var sideBarNavWidth = $(parentPanel).width() - parseInt(elem.css('paddingLeft')) - parseInt(elem.css('paddingRight')) - parseInt(elem.css('marginLeft')) - parseInt(elem.css('marginRight')) - parseInt(elem.css('borderLeftWidth')) - parseInt(elem.css('borderRightWidth'));
|
121
|
+
elem.css('width', sideBarNavWidth);
|
122
|
+
};
|
123
|
+
|
124
|
+
resizeFn();
|
125
|
+
$(window).resize(resizeFn);
|
126
|
+
});
|
127
|
+
|
128
|
+
})
|
129
|
+
|
130
|
+
|
131
|
+
}(window.jQuery);
|