]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Documentation JS script | |
3 | */ | |
4 | $(function () { | |
5 | var slideToTop = $("<div />"); | |
6 | slideToTop.html('<i class="fa fa-chevron-up"></i>'); | |
7 | slideToTop.css({ | |
8 | position: 'fixed', | |
9 | bottom: '20px', | |
10 | right: '25px', | |
11 | width: '40px', | |
12 | height: '40px', | |
13 | color: '#eee', | |
14 | 'font-size': '', | |
15 | 'line-height': '40px', | |
16 | 'text-align': 'center', | |
17 | 'background-color': '#222d32', | |
18 | cursor: 'pointer', | |
19 | 'border-radius': '5px', | |
20 | 'z-index': '99999', | |
21 | opacity: '.7', | |
22 | 'display': 'none' | |
23 | }); | |
24 | slideToTop.on('mouseenter', function () { | |
25 | $(this).css('opacity', '1'); | |
26 | }); | |
27 | slideToTop.on('mouseout', function () { | |
28 | $(this).css('opacity', '.7'); | |
29 | }); | |
30 | $('.wrapper').append(slideToTop); | |
31 | $(window).scroll(function () { | |
32 | if ($(window).scrollTop() >= 150) { | |
33 | if (!$(slideToTop).is(':visible')) { | |
34 | $(slideToTop).fadeIn(500); | |
35 | } | |
36 | } else { | |
37 | $(slideToTop).fadeOut(500); | |
38 | } | |
39 | }); | |
40 | $(slideToTop).click(function () { | |
41 | $("body").animate({ | |
42 | scrollTop: 0 | |
43 | }, 500); | |
44 | }); | |
45 | $(".sidebar-menu li:not(.treeview) a").click(function () { | |
46 | var $this = $(this); | |
47 | var target = $this.attr("href"); | |
48 | if (typeof target === 'string') { | |
49 | $("body").animate({ | |
50 | scrollTop: ($(target).offset().top) + "px" | |
51 | }, 500); | |
52 | } | |
53 | }); | |
54 | //Skin switcher | |
55 | var current_skin = "skin-blue"; | |
56 | $('#layout-skins-list [data-skin]').click(function(e) { | |
57 | e.preventDefault(); | |
58 | var skinName = $(this).data('skin'); | |
59 | $('body').removeClass(current_skin); | |
60 | $('body').addClass(skinName); | |
61 | current_skin = skinName; | |
62 | }); | |
63 | }); |