blob: e943f448a7980923a55ea4d7eb0a7cf698569830 (
plain)
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
|
$ ->
stickyActions = []
ptitleCont = ""
$(document).on 'page:before-change', ->
stickyActions = []
ptitleCont = ""
$el = $('#main_nav')
# Opening/closing left-side menu
$el.find('.openMenu').on 'click', (e) ->
$(this).parent().addClass 'open'
$el.find('.closeMenu').on 'click', (e) ->
$(this).closest('.nav-menu').removeClass 'open'
# Opening menu panel according to current url
selectedItem = $el.find('.active')
selectedItem.closest('.panel-collapse').addClass 'in'
selectedItem.closest('.panel-title').children('a').attr('aria-expanded') == true
sticker = () ->
limit = 51
if $(window).scrollTop() >= limit
if stickyActions.length == 0
if ($('.page-action .small').length > 0)
stickyActions.push
content: [
$('.page-action .small'),
$('.page-action .small').first().next()
]
originalParent: $('.page-action .small').parent()
for action in $(".sticky-action, .sticky-actions")
stickyActions.push
class: "small",
content: [$(action)]
originalParent: $(action).parent()
if $(".page-title").length > 0
ptitleCont = $(".page-title").html()
stickyContent = $('<div class="sticky-content"></div>')
stickyContent.append $("<div class='sticky-ptitle'>#{ptitleCont}</div>")
stickyContent.append $('<div class="sticky-paction"></div>')
$('#main_nav').addClass 'sticky'
if $('#menu_top').find('.sticky-content').length == 0
if ptitleCont.length > 0
$('#menu_top').children('.menu-content').after(stickyContent)
for item in stickyActions
for child in item.content
child.appendTo $('.sticky-paction')
else
$('#main_nav').removeClass 'sticky'
if $('#menu_top').find('.sticky-content').length > 0
for item in stickyActions
for child in item.content
child.appendTo item.originalParent
$('.sticky-content').remove()
sticker()
# Sticky behavior
$(document).on 'scroll', sticker
|