Welcome to mirror list, hosted at ThFree Co, Russian Federation.

zozo.js « js « static - github.com/varkai/hugo-theme-zozo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 278144256fecc17ae4aaa2d25d4a2c3ff223ae76 (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
'use strict';

// back-to-top
$(document).ready((function (_this) {
  return function () {
    let bt
    bt = $('#back_to_top')
    if ($(document).width() > 480) {
      $(window).scroll(function () {
        let st
        st = $(window).scrollTop()
        if (st > 30) {
          return bt.css('display', 'block')
        } else {
          return bt.css('display', 'none')
        }
      })
      return bt.click(function () {
        $('body,html').animate({
          scrollTop: 0,
        }, 800)
        return false
      })
    }
  }
})(this))

// fancybox
$(document).ready((function (_this) {
  return function() {
    if ($.fancybox) {
      $('.post_content').each(function() {
        $(this).find('img').each(function() {
          $(this).wrap(`<div class="fancybox"><a href="${this.src}" data-fancybox="gallery" data-caption="${this.title}"></a></div>`);
        });
      });
    }
  };
})(this))