framous 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.mkdn +6 -0
- data/stylesheets/framous/base/_base.scss +3 -1
- data/stylesheets/framous/base/_typography.scss +3 -4
- data/templates/project/config.rb +28 -0
- data/templates/project/index.html +2 -0
- data/templates/project/javascripts/plugins/framous.collapse.js +336 -0
- data/templates/project/javascripts/plugins/framous.dropdown.js +212 -0
- data/templates/project/javascripts/plugins/framous.modal.js +163 -0
- data/templates/project/javascripts/plugins/framous.scrollspy.js +221 -0
- data/templates/project/javascripts/plugins/framous.sticky.js +75 -0
- data/templates/project/javascripts/plugins/framous.toggle.js +162 -0
- data/templates/project/javascripts/plugins/framous.tooltip.js +262 -0
- data/templates/project/javascripts/vendors/jquery-1.10.1.min.js +6 -0
- data/templates/project/manifest.rb +15 -1
- data/templates/project/screen.scss +7 -1
- data/templates/project/stylesheets/layout/_footer.scss +3 -0
- data/templates/project/stylesheets/layout/_header.scss +3 -0
- data/templates/project/stylesheets/layout/_main.scss +3 -0
- metadata +16 -5
- data/templates/project/_settings.scss +0 -91
data/CHANGELOG.mkdn
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Framous Changelog
|
2
2
|
=================
|
3
3
|
|
4
|
+
v0.3.3 [Jul 25, 2013]
|
5
|
+
---------------------
|
6
|
+
* manifest.rb : major updates
|
7
|
+
* custom config.rb
|
8
|
+
* new javascripts & stylesheets files
|
9
|
+
|
4
10
|
v0.3.2 [Jul 23, 2013]
|
5
11
|
---------------------
|
6
12
|
* typo & some changes here and there
|
@@ -1,10 +1,12 @@
|
|
1
1
|
/* ---------------------------------------------------------------------------
|
2
|
-
Base
|
2
|
+
Base Layout Style : Body, Header, Main, Footer
|
3
3
|
*/
|
4
4
|
|
5
5
|
body {
|
6
6
|
@include pie-clearfix;
|
7
|
+
position: relative;
|
7
8
|
width: 100%;
|
9
|
+
background: $background-body-color;
|
8
10
|
}
|
9
11
|
|
10
12
|
.out-container {
|
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/* ---------------------------------------------------------------------------
|
2
|
+
Typography
|
3
|
+
*/
|
3
4
|
|
4
5
|
body,div,dl,dt,dd,ul,ol,li,
|
5
6
|
h1,h2,h3,h4,h5,h6,
|
@@ -12,8 +13,6 @@ pre,form,p,blockquote,th,td {
|
|
12
13
|
|
13
14
|
body {
|
14
15
|
@include establish-baseline;
|
15
|
-
position: relative;
|
16
|
-
background: $background-body-color;
|
17
16
|
color: $body-font-color;
|
18
17
|
font-family: $body-font-family;
|
19
18
|
font-weight: $font-weight-normal;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'framous'
|
2
|
+
# Require any additional compass plugins here.
|
3
|
+
|
4
|
+
|
5
|
+
# Set this to the root of your project when deployed:
|
6
|
+
http_path = "/"
|
7
|
+
css_dir = "stylesheets"
|
8
|
+
sass_dir = "sass"
|
9
|
+
images_dir = "images"
|
10
|
+
javascripts_dir = "javascripts"
|
11
|
+
|
12
|
+
# You can select your preferred output style here (can be overridden via the command line):
|
13
|
+
# output_style = :expanded or :nested or :compact or :compressed
|
14
|
+
|
15
|
+
# To enable relative paths to assets via compass helper functions. Uncomment:
|
16
|
+
# relative_assets = true
|
17
|
+
|
18
|
+
# To disable debugging comments that display the original location of your selectors. Uncomment:
|
19
|
+
line_comments = false
|
20
|
+
|
21
|
+
Sass::Script::Number.precision = 4
|
22
|
+
|
23
|
+
|
24
|
+
# If you prefer the indented syntax, you might want to regenerate this
|
25
|
+
# project again passing --syntax sass, or you can uncomment this:
|
26
|
+
# preferred_syntax = :sass
|
27
|
+
# and then run:
|
28
|
+
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
|
@@ -38,6 +38,8 @@
|
|
38
38
|
</footer><!-- /footer -->
|
39
39
|
|
40
40
|
<!-- JS -->
|
41
|
+
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
|
42
|
+
<script>window.jQuery || document.write('<script src="javascripts/vendor/jquery-1.10.1.min.js"><\/script>')</script>
|
41
43
|
|
42
44
|
</body>
|
43
45
|
</html>
|
@@ -0,0 +1,336 @@
|
|
1
|
+
/*
|
2
|
+
* Collapse plugin for jQuery
|
3
|
+
* --
|
4
|
+
* source: http://github.com/borderlab/framous
|
5
|
+
* site:
|
6
|
+
*
|
7
|
+
* @author Thomas Hermant (http://hanami.be)
|
8
|
+
* Copyright 2013, Thomas Hermant
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function ( $ ) {
|
13
|
+
|
14
|
+
var is_touch = !!('ontouchstart' in window) || !!('onmsgesturechange' in window),
|
15
|
+
currentIndex = {},
|
16
|
+
btns= {},
|
17
|
+
contents = {},
|
18
|
+
// add event depending of touch device or not
|
19
|
+
add_event = function(el, action)
|
20
|
+
{
|
21
|
+
if(is_touch)
|
22
|
+
{
|
23
|
+
var init_x, int_y, delta_x, delta_y;
|
24
|
+
|
25
|
+
el.on("touchstart.framous.collapse", function(e){
|
26
|
+
init_x = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageX : 0;
|
27
|
+
init_y = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageY : 0;
|
28
|
+
delta_x = 0;
|
29
|
+
delta_y = 0;
|
30
|
+
});
|
31
|
+
|
32
|
+
el.on("touchmove.framous.collapse", function(e){
|
33
|
+
delta_x = e.originalEvent.touches[0].pageX - init_x;
|
34
|
+
delta_y = e.originalEvent.touches[0].pageY - init_y;
|
35
|
+
});
|
36
|
+
|
37
|
+
el.on("touchend.framous.collapse", function(e){
|
38
|
+
e.preventDefault();
|
39
|
+
|
40
|
+
// tap event -> no scroll
|
41
|
+
if(Math.abs(delta_x) < 2 && Math.abs(delta_y) < 2)
|
42
|
+
{
|
43
|
+
action(e);
|
44
|
+
}
|
45
|
+
});
|
46
|
+
}
|
47
|
+
else
|
48
|
+
{
|
49
|
+
el.on("click.framous.collapse",function(e){
|
50
|
+
action(e);
|
51
|
+
});
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
var methods = {
|
56
|
+
init : function( options )
|
57
|
+
{
|
58
|
+
// default options
|
59
|
+
var settings = $.extend({
|
60
|
+
content: 'js-content',
|
61
|
+
active_btn_class: "is-active",
|
62
|
+
active_content_class: "is-visible",
|
63
|
+
accordeon: true,
|
64
|
+
circular: true,
|
65
|
+
open_indexes: [],
|
66
|
+
show_time : 400,
|
67
|
+
hide_time: 400,
|
68
|
+
|
69
|
+
// effect: slide, fade, show, custom
|
70
|
+
effect: "slide",
|
71
|
+
|
72
|
+
// Custom Effect show - hide
|
73
|
+
custom_show : function(index, currentIndex, contents, onEnd, time){},
|
74
|
+
custom_hide : function(index, currentIndex, contents, onEnd, time){},
|
75
|
+
|
76
|
+
// event handler
|
77
|
+
before_show: null,
|
78
|
+
show: null,
|
79
|
+
before_hide: null,
|
80
|
+
hide: null,
|
81
|
+
|
82
|
+
}, options );
|
83
|
+
|
84
|
+
var selector = this.selector;
|
85
|
+
|
86
|
+
// boutons
|
87
|
+
btns[selector] = this;
|
88
|
+
|
89
|
+
// contents
|
90
|
+
contents[selector] = $("." + settings.content);
|
91
|
+
|
92
|
+
// currentIndex : used when only one open
|
93
|
+
currentIndex[selector] = (settings.open_indexes.length == 1) ? settings.open_indexes[0] : null;
|
94
|
+
|
95
|
+
// disable accordeon mode if more than one index open
|
96
|
+
if(settings.open_indexes.length > 1)
|
97
|
+
{
|
98
|
+
settings.accordeon = false
|
99
|
+
}
|
100
|
+
|
101
|
+
// set default
|
102
|
+
if(settings.allClose && settings.open_indexes.length == 0)
|
103
|
+
{
|
104
|
+
currentIndex[selector] = -1;
|
105
|
+
}
|
106
|
+
|
107
|
+
// Default effects functions
|
108
|
+
switch(settings.effect)
|
109
|
+
{
|
110
|
+
case "slide":
|
111
|
+
settings.custom_show = function(index, currentIndex,contents, time , onEnd){
|
112
|
+
contents.eq(index).slideDown(time, onEnd);
|
113
|
+
}
|
114
|
+
|
115
|
+
settings.custom_hide = function(index, currentIndex,contents, time, onEnd){
|
116
|
+
contents.eq(index).slideUp(time, onEnd);
|
117
|
+
}
|
118
|
+
break;
|
119
|
+
|
120
|
+
case "show":
|
121
|
+
settings.custom_show = function(index, currentIndex,contents ,time, onEnd){
|
122
|
+
contents.eq(index).show();
|
123
|
+
onEnd();
|
124
|
+
}
|
125
|
+
|
126
|
+
settings.custom_hide = function(index, currentIndex,contents ,time, onEnd){
|
127
|
+
contents.eq(index).hide();
|
128
|
+
onEnd();
|
129
|
+
}
|
130
|
+
break;
|
131
|
+
case "fade":
|
132
|
+
settings.custom_show = function(index, currentIndex,contents ,time, onEnd){
|
133
|
+
contents.eq(index).fadeIn(time, onEnd);
|
134
|
+
}
|
135
|
+
|
136
|
+
settings.custom_hide = function(index, currentIndex,contents ,time, onEnd){
|
137
|
+
contents.eq(index).fadeOut(time, onEnd);
|
138
|
+
}
|
139
|
+
break;
|
140
|
+
}
|
141
|
+
|
142
|
+
// show only indexes
|
143
|
+
if (settings.open_indexes.length > 0)
|
144
|
+
{
|
145
|
+
// hide all
|
146
|
+
if(settings.effect != "custom")
|
147
|
+
{
|
148
|
+
contents[selector].hide();
|
149
|
+
}
|
150
|
+
|
151
|
+
// open when in indexes
|
152
|
+
var l = settings.open_indexes.length;
|
153
|
+
for(var i = 0; i < l ; i++)
|
154
|
+
{
|
155
|
+
var index = settings.open_indexes[i];
|
156
|
+
btns[selector].eq(index).addClass(settings.active_btn_class)
|
157
|
+
contents[selector].eq(index).addClass(settings.active_content_class).show();
|
158
|
+
}
|
159
|
+
}
|
160
|
+
// show all content
|
161
|
+
else
|
162
|
+
{
|
163
|
+
btns[selector].addClass(settings.active_btn_class)
|
164
|
+
contents[selector].addClass(settings.active_content_class)
|
165
|
+
}
|
166
|
+
|
167
|
+
// open content
|
168
|
+
var openContent = function(i)
|
169
|
+
{
|
170
|
+
if (i < 0) return;
|
171
|
+
|
172
|
+
if(settings.before_show != null)
|
173
|
+
{
|
174
|
+
settings.before_show(i, currentIndex[selector], contents[selector]);
|
175
|
+
}
|
176
|
+
|
177
|
+
var onFinished = null;
|
178
|
+
if(settings.show != null)
|
179
|
+
{
|
180
|
+
onFinished = function()
|
181
|
+
{
|
182
|
+
settings.show(i, currentIndex[selector], contents[selector]);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
var c = contents[selector].eq(i).addClass(settings.active_content_class);
|
187
|
+
settings.custom_show(i, currentIndex[selector], contents[selector],settings.show_time,onFinished);
|
188
|
+
};
|
189
|
+
|
190
|
+
// close content
|
191
|
+
var closeContent = function(i)
|
192
|
+
{
|
193
|
+
if (i < 0) return;
|
194
|
+
|
195
|
+
if(settings.before_hide != null)
|
196
|
+
{
|
197
|
+
settings.before_hide(i, contents[selector]);
|
198
|
+
}
|
199
|
+
|
200
|
+
var onFinished = null;
|
201
|
+
if(settings.hide != null)
|
202
|
+
{
|
203
|
+
onFinished = function()
|
204
|
+
{
|
205
|
+
settings.hide(i, contents[selector]);
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
var c = contents[selector].eq(i).removeClass(settings.active_content_class)
|
210
|
+
settings.custom_hide(i, currentIndex[selector],contents[selector],settings.show_time,onFinished);
|
211
|
+
|
212
|
+
btns[selector].eq(i).removeClass(settings.active_btn_class);
|
213
|
+
};
|
214
|
+
|
215
|
+
// chaining
|
216
|
+
return this.each(function(index) {
|
217
|
+
|
218
|
+
// get the btn
|
219
|
+
var btn = $(this);
|
220
|
+
|
221
|
+
var event_btn_action = function(e)
|
222
|
+
{
|
223
|
+
e.preventDefault();
|
224
|
+
|
225
|
+
// toggle class is-open
|
226
|
+
btn.toggleClass(settings.active_btn_class);
|
227
|
+
|
228
|
+
// open content
|
229
|
+
if(btn.hasClass(settings.active_btn_class))
|
230
|
+
{
|
231
|
+
openContent(index);
|
232
|
+
|
233
|
+
// if accordeon, on open -> close the current content
|
234
|
+
if(settings.accordeon && currentIndex[selector] != null)
|
235
|
+
{
|
236
|
+
// avoid open and directly close content
|
237
|
+
if(currentIndex[selector] != index)
|
238
|
+
{
|
239
|
+
closeContent(currentIndex[selector]);
|
240
|
+
}
|
241
|
+
currentIndex[selector] = index;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
// close content
|
245
|
+
else
|
246
|
+
{
|
247
|
+
closeContent(index);
|
248
|
+
}
|
249
|
+
};
|
250
|
+
|
251
|
+
add_event(btn,event_btn_action);
|
252
|
+
});
|
253
|
+
},
|
254
|
+
next : function(circular)
|
255
|
+
{
|
256
|
+
if(circular == undefined)
|
257
|
+
{
|
258
|
+
circular = true
|
259
|
+
}
|
260
|
+
methods.nextSlide(this.selector, circular);
|
261
|
+
},
|
262
|
+
// Show next content
|
263
|
+
nextSlide : function(selector,circular)
|
264
|
+
{
|
265
|
+
var nextIndex = currentIndex[selector];
|
266
|
+
if(++nextIndex >= contents[selector].length)
|
267
|
+
{
|
268
|
+
nextIndex = contents[selector].length - 1;
|
269
|
+
if(circular)
|
270
|
+
{
|
271
|
+
nextIndex = 0;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
if(nextIndex != currentIndex[selector])
|
276
|
+
{
|
277
|
+
var btn = btns[selector].eq(nextIndex);
|
278
|
+
btn.trigger((is_touch ? "touchstart.framous.collapse" : "click.framous.collapse"));
|
279
|
+
if (is_touch)
|
280
|
+
{
|
281
|
+
btn.trigger("touchend.framous.collapse");
|
282
|
+
}
|
283
|
+
}
|
284
|
+
},
|
285
|
+
prev : function(circular)
|
286
|
+
{
|
287
|
+
if(circular == undefined)
|
288
|
+
{
|
289
|
+
circular = true
|
290
|
+
}
|
291
|
+
methods.prevSlide(this.selector, circular)
|
292
|
+
},
|
293
|
+
// Show previous content
|
294
|
+
prevSlide : function(selector,circular)
|
295
|
+
{
|
296
|
+
var prevIndex = currentIndex[selector];
|
297
|
+
if(--prevIndex < 0)
|
298
|
+
{
|
299
|
+
prevIndex = 0;
|
300
|
+
|
301
|
+
if(circular)
|
302
|
+
{
|
303
|
+
prevIndex = contents[selector].length - 1;
|
304
|
+
}
|
305
|
+
}
|
306
|
+
|
307
|
+
if(prevIndex != currentIndex[selector])
|
308
|
+
{
|
309
|
+
var btn = btns[selector].eq(prevIndex);
|
310
|
+
btn.trigger((is_touch ? "touchstart.framous.collapse" : "click.framous.collapse"));
|
311
|
+
if (is_touch)
|
312
|
+
{
|
313
|
+
btn.trigger("touchend.framous.collapse");
|
314
|
+
}
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}
|
318
|
+
|
319
|
+
$.fn.collapse = function(methodOrOptions)
|
320
|
+
{
|
321
|
+
if ( methods[methodOrOptions] )
|
322
|
+
{
|
323
|
+
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
324
|
+
}
|
325
|
+
else if ( typeof methodOrOptions === 'object' || ! methodOrOptions )
|
326
|
+
{
|
327
|
+
// Default to "init"
|
328
|
+
return methods.init.apply( this, arguments );
|
329
|
+
}
|
330
|
+
else
|
331
|
+
{
|
332
|
+
$.error( 'Method ' + method + ' does not exist on jQuery.tooltip' );
|
333
|
+
}
|
334
|
+
};
|
335
|
+
|
336
|
+
}( jQuery ));
|
@@ -0,0 +1,212 @@
|
|
1
|
+
/*
|
2
|
+
* Dropdown plugin for jQuery
|
3
|
+
* --
|
4
|
+
* source: http://github.com/borderlab/framous
|
5
|
+
* site:
|
6
|
+
*
|
7
|
+
* @author Thomas Hermant (http://hanami.be)
|
8
|
+
* Copyright 2013, Thomas Hermant
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function ( $ ) {
|
13
|
+
|
14
|
+
// global vars
|
15
|
+
var is_touch = !!('ontouchstart' in window) || !!('onmsgesturechange' in window),
|
16
|
+
dropdown_containers,
|
17
|
+
dropdowns,
|
18
|
+
all_dropdown_items,
|
19
|
+
body,
|
20
|
+
div_open = $('<div/>'),
|
21
|
+
current_dropdown_link,
|
22
|
+
add_event = function(el, action)
|
23
|
+
{
|
24
|
+
if(is_touch)
|
25
|
+
{
|
26
|
+
var init_x, int_y, delta_x, delta_y;
|
27
|
+
|
28
|
+
el.on("touchstart.framous.dropdown", function(e){
|
29
|
+
init_x = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageX : 0;
|
30
|
+
init_y = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageY : 0;
|
31
|
+
delta_x = 0;
|
32
|
+
delta_y = 0;
|
33
|
+
});
|
34
|
+
|
35
|
+
el.on("touchmove.framous.dropdown", function(e){
|
36
|
+
delta_x = e.originalEvent.touches[0].pageX - init_x;
|
37
|
+
delta_y = e.originalEvent.touches[0].pageY - init_y;
|
38
|
+
});
|
39
|
+
|
40
|
+
el.on("touchend.framous.dropdown", function(e){
|
41
|
+
e.preventDefault();
|
42
|
+
|
43
|
+
// tap event -> no scroll
|
44
|
+
if(Math.abs(delta_x) < 2 && Math.abs(delta_y) < 2)
|
45
|
+
{
|
46
|
+
action(e);
|
47
|
+
}
|
48
|
+
});
|
49
|
+
}
|
50
|
+
else
|
51
|
+
{
|
52
|
+
el.on("click.framous.dropdown",function(e){
|
53
|
+
action(e);
|
54
|
+
});
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
|
59
|
+
var methods = {
|
60
|
+
|
61
|
+
init : function( options ) {
|
62
|
+
|
63
|
+
// default options
|
64
|
+
var settings = $.extend({
|
65
|
+
z_index: 1,
|
66
|
+
open_class: "is-open",
|
67
|
+
active_class: "is-active",
|
68
|
+
dropdown_class: "js-menu-dropdown",
|
69
|
+
dropdown_link: "js-dropdown-link",
|
70
|
+
active_dropdown_class: "is-visible",
|
71
|
+
dropdown_item_class: "js-menu-dropdown-item",
|
72
|
+
active_dropdown_item_class: "is-active",
|
73
|
+
|
74
|
+
}, options );
|
75
|
+
|
76
|
+
dropdown_containers = this;
|
77
|
+
dropdowns = dropdown_containers.find("." + settings.dropdown_class);
|
78
|
+
all_dropdown_items = dropdowns.find("." + settings.dropdown_item_class);
|
79
|
+
body = $("body");
|
80
|
+
div_open.css({position:"fixed",zIndex:settings.z_index - 1,left:0,right:0,top:0,bottom:0,background:"rgba(0,0,0,0)"});
|
81
|
+
|
82
|
+
var close_dropdowns = function()
|
83
|
+
{
|
84
|
+
// close all dropdown
|
85
|
+
dropdown_containers.removeClass(settings.open_class);
|
86
|
+
dropdowns.removeClass(settings.active_dropdown_class);
|
87
|
+
};
|
88
|
+
|
89
|
+
var active_dropdown_container = function()
|
90
|
+
{
|
91
|
+
dropdown_containers.removeClass(settings.active_class);
|
92
|
+
if(dropdown_containers.find("." + settings.active_dropdown_item_class).length != 0)
|
93
|
+
{
|
94
|
+
dropdown_containers.each(function(i){
|
95
|
+
var dd_c = $(this);
|
96
|
+
|
97
|
+
if(dd_c.find("." + settings.active_dropdown_item_class).length > 0)
|
98
|
+
{
|
99
|
+
dd_c.addClass(settings.active_class);
|
100
|
+
}
|
101
|
+
});
|
102
|
+
}
|
103
|
+
};
|
104
|
+
|
105
|
+
// chaining
|
106
|
+
return this.each(function(index){
|
107
|
+
var dropdown_container = $(this);
|
108
|
+
var dropdown_link = dropdown_container.find("." + settings.dropdown_link);
|
109
|
+
var dropdown = dropdowns.eq(index);
|
110
|
+
var dropdown_items = dropdown.find("." + settings.dropdown_item_class);
|
111
|
+
|
112
|
+
var dropdown_container_action_event = function(e)
|
113
|
+
{
|
114
|
+
current_dropdown_link = dropdown_link;
|
115
|
+
|
116
|
+
// check if already displayed
|
117
|
+
var is_open= dropdown_container.hasClass(settings.open_class);
|
118
|
+
div_open.remove();
|
119
|
+
|
120
|
+
close_dropdowns();
|
121
|
+
|
122
|
+
// deactive all container
|
123
|
+
dropdown_containers.removeClass(settings.active_class);
|
124
|
+
dropdown_container.addClass(settings.active_class);
|
125
|
+
|
126
|
+
// if not already displayed -> display
|
127
|
+
if(!is_open)
|
128
|
+
{
|
129
|
+
// div open
|
130
|
+
if (is_touch)
|
131
|
+
{
|
132
|
+
body.append(div_open);
|
133
|
+
var div_open_action_event = function(e){
|
134
|
+
close_dropdowns();
|
135
|
+
div_open.remove();
|
136
|
+
active_dropdown_container();
|
137
|
+
};
|
138
|
+
add_event(div_open,div_open_action_event);
|
139
|
+
}
|
140
|
+
else
|
141
|
+
{
|
142
|
+
// create blur event (call after mousedown and before click)
|
143
|
+
dropdown_link.on("blur.framous.dropdown", function(e){
|
144
|
+
|
145
|
+
if (current_dropdown_link == dropdown_link)
|
146
|
+
{
|
147
|
+
close_dropdowns();
|
148
|
+
active_dropdown_container();
|
149
|
+
}
|
150
|
+
// kill blur event
|
151
|
+
dropdown_link.off("blur.framous.dropdown");
|
152
|
+
});
|
153
|
+
|
154
|
+
}
|
155
|
+
|
156
|
+
dropdown_container.addClass(settings.open_class);
|
157
|
+
setInterval(function(){dropdown.addClass(settings.active_dropdown_class)},0);
|
158
|
+
}
|
159
|
+
else
|
160
|
+
{
|
161
|
+
active_dropdown_container();
|
162
|
+
}
|
163
|
+
};
|
164
|
+
add_event(dropdown_container,dropdown_container_action_event);
|
165
|
+
|
166
|
+
// add action on dropdown_item
|
167
|
+
dropdown_items.each(function(i){
|
168
|
+
var dropdown_item = $(this);
|
169
|
+
var dropdown_item_action_event = function(e)
|
170
|
+
{
|
171
|
+
// active the item
|
172
|
+
all_dropdown_items.removeClass(settings.active_dropdown_item_class);
|
173
|
+
dropdown_item.addClass(settings.active_dropdown_item_class);
|
174
|
+
};
|
175
|
+
add_event(dropdown_item, dropdown_item_action_event);
|
176
|
+
});
|
177
|
+
|
178
|
+
// no link in url for dropdown_link
|
179
|
+
add_event(dropdown_link,function(e){
|
180
|
+
e.preventDefault();
|
181
|
+
dropdown_link.focus();
|
182
|
+
});
|
183
|
+
|
184
|
+
if (! is_touch)
|
185
|
+
{
|
186
|
+
// avoid the blur action -> mousedown is called before the blur event and before the click
|
187
|
+
dropdown_container.on("mousedown.framous.dropdown",function(){
|
188
|
+
current_dropdown_link = undefined;
|
189
|
+
});
|
190
|
+
}
|
191
|
+
});
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
$.fn.dropdown = function(methodOrOptions)
|
196
|
+
{
|
197
|
+
if ( methods[methodOrOptions] )
|
198
|
+
{
|
199
|
+
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
200
|
+
}
|
201
|
+
else if ( typeof methodOrOptions === 'object' || ! methodOrOptions )
|
202
|
+
{
|
203
|
+
// Default to "init"
|
204
|
+
return methods.init.apply( this, arguments );
|
205
|
+
}
|
206
|
+
else
|
207
|
+
{
|
208
|
+
$.error('Method ' + method + ' does not exist on jQuery.scrollspy');
|
209
|
+
}
|
210
|
+
};
|
211
|
+
|
212
|
+
}( jQuery ));
|