diff options
author | imzeuk <imzeuk@gmail.com> | 2019-04-12 16:23:28 +0300 |
---|---|---|
committer | imzeuk <imzeuk@gmail.com> | 2019-04-12 16:23:28 +0300 |
commit | e1fd34fc369fccdc69e38d2da98ef9556d15da06 (patch) | |
tree | e6828cc0fc576d2abedad3bc0e8200a66335b76a /static/js/zozo.js |
first commitv1.0.0
Diffstat (limited to 'static/js/zozo.js')
-rw-r--r-- | static/js/zozo.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/static/js/zozo.js b/static/js/zozo.js new file mode 100644 index 0000000..2781442 --- /dev/null +++ b/static/js/zozo.js @@ -0,0 +1,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)) |