Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
776 lars 1
/**
2
Core script to handle the entire theme and core functions
3
**/
4
var Layout = function() {
5
 
6
    var layoutImgPath = 'layouts/layout7/img/';
7
 
8
    var layoutCssPath = 'layouts/layout7/css/';
9
 
10
    var resBreakpointMd = App.getResponsiveBreakpoint('md'); //992px
11
    var resBreakpointSm = App.getResponsiveBreakpoint('sm'); //768px
12
 
13
    // handle go to top button
14
    var handleGo2Top = function () {
15
        var Go2TopOperation = function(){
16
            var CurrentWindowPosition = $(window).scrollTop();// current vertical position
17
            if (CurrentWindowPosition > 100) {
18
                $(".go2top").show();
19
            } else {
20
                $(".go2top").hide();
21
            }
22
        };
23
 
24
        Go2TopOperation();// call headerFix() when the page was loaded
25
        if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {
26
            $(window).bind("touchend touchcancel touchleave", function(e){
27
                Go2TopOperation();
28
            });
29
        } else {
30
            $(window).scroll(function() {
31
                Go2TopOperation();
32
            });
33
        }
34
 
35
        $(".go2top").click(function(e) {
36
            e.preventDefault();
37
            $("html, body").animate({ scrollTop: 0 }, 600);
38
        });
39
    };
40
 
41
    var handleMenu = function () {
42
        var overlay = $('.menu-bg-overlay');
43
        var close = $('.menu-close');
44
        var trigger = $('.menu-trigger');
45
        var modal = $('.menu-overlay');
46
 
47
        trigger.click(function() {
48
            var removeModal = function() {
49
                modal.removeClass('menu-overlay-show');
50
            }
51
 
52
            modal.addClass('menu-overlay-show');
53
            overlay.off('click', removeModal);
54
            overlay.on('click', removeModal);
55
        });
56
 
57
        close.click(function(e) {
58
            e.stopPropagation();
59
            modal.removeClass('menu-overlay-show');
60
        });
61
    };
62
 
63
    return {
64
 
65
        // Main init methods to initialize the layout
66
        // IMPORTANT!!!: Do not modify the core handlers call order.
67
 
68
        init: function () {
69
            handleGo2Top(); // handle go to top
70
            handleMenu(); // handle menu
71
        },
72
 
73
        getLayoutImgPath: function() {
74
            return App.getAssetsPath() + layoutImgPath;
75
        },
76
 
77
        getLayoutCssPath: function() {
78
            return App.getAssetsPath() + layoutCssPath;
79
        }
80
    };
81
 
82
}();
83
 
84
jQuery(document).ready(function() {
85
   Layout.init(); // init metronic core componets
86
});