-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.js
73 lines (52 loc) · 1.91 KB
/
application.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Our project namespace.
* Search and replace project_namespace to match the desired client/project namespace
*/
project_namespace.init = function() {
/* Globally cache the jQuery reference to the document to avoid repeated lookups.
* This should be used as the base of all document-wide
* searches where a closer context isn't available e.g.
* var $someElement = $.root.find(someSelector);
*/
$.root = $(document.body);
/*=====================================
* Setup breakpoints
*
* Set up responsive breakpoint handlers using jquery.breakpoint.js
* http://www.myjqueryplugins.com/jquery-plugin/breakpoint
* Requires amended matchMedia.js to support IE8/7 https://github.com/benschwarz/matchMedia.js/commit/759810b55ffdf518d26ed87c95a6c1e1ec6ce1a1
*/
// Handler for smaller than breakpoint inner
$.breakpoint({
condition: function ()
{
return window.matchMedia('screen and (max-width:' + (project_namespace.breakpoint_inner - 1) + 'px)').matches;
},
enter: function ()
{
// code to execute on entering breakpoint
// Maybe set a breakpoint class
project_namespace.setBreakpointClass(project_namespace.breakpoint_inner, true);
// example setup function
project_namespace.setupMainNavSmall();
},
exit: function ()
{
// code to execute on exiting breakpoint
// Maybe remove a breakpoint class
project_namespace.setBreakpointClass(project_namespace.breakpoint_inner, false);
}
});
// Delegate .transition() calls to .animate()
// if the browser can't do CSS transitions.
if (!$.support.transition) $.fn.transition = $.fn.animate;
/*=====================================
Call modularised setup functions
*/
// example setup function
project_namespace.loadDesktopImages();
};
/* Call the project_namespace init function
* This syntax is equivalant to calling $(document).ready();
*/
$(function() {project_namespace.init();});