Ghost_Ruby_Theme/assets/js/main.js

77 lines
1.8 KiB
JavaScript
Raw Normal View History

2019-05-04 19:02:00 +03:00
var body = $('body');
2019-04-29 19:46:11 +03:00
$(function () {
'use strict';
social();
2019-04-30 18:00:55 +03:00
author();
2019-05-04 08:01:50 +03:00
stickySidebar();
pagination();
2019-05-04 19:02:00 +03:00
offCanvas();
2019-04-29 19:46:11 +03:00
});
function social() {
'use strict';
var data = {
facebook: {name: 'Facebook', icon: 'facebook'},
twitter: {name: 'Twitter', icon: 'twitter'},
instagram: {name: 'Instagram', icon: 'instagram'},
dribbble: {name: 'Dribbble', icon: 'dribbble'},
behance: {name: 'Behance', icon: 'behance'},
github: {name: 'GitHub', icon: 'github-circle'},
linkedin: {name: 'LinkedIn', icon: 'linkedin'},
vk: {name: 'VK', icon: 'vk'},
rss: {name: 'RSS', icon: 'rss'},
};
var links = themeOptions.social_links;
var output = '';
for (var key in links) {
if (links[key] != '') {
output += '<a class="social-item" href="' + links[key] + '" target="_blank"><i class="icon icon-' + data[key]['icon'] + '"></i></a>';
}
}
$('.social').html(output);
2019-04-30 18:00:55 +03:00
}
function author() {
'use strict';
$('.author-name').on('click', function () {
$(this).next('.author-social').toggleClass('enabled');
});
}
function stickySidebar() {
'use strict';
var marginTop = 30;
2019-05-04 19:02:00 +03:00
jQuery('.sidebar-column, .related-column').theiaStickySidebar({
2019-04-30 18:00:55 +03:00
additionalMarginTop: marginTop,
additionalMarginBottom: 30,
});
2019-05-04 08:01:50 +03:00
}
function pagination() {
'use strict';
var wrapper = $('.post-feed .row');
2019-05-04 19:02:00 +03:00
if (body.hasClass('paged-next')) {
2019-05-04 08:01:50 +03:00
wrapper.infiniteScroll({
append: '.post-column',
button: '.infinite-scroll-button',
debug: false,
hideNav: '.pagination',
history: false,
path: '.pagination .older-posts',
scrollThreshold: false,
status: '.infinite-scroll-status',
});
}
2019-05-04 19:02:00 +03:00
}
function offCanvas() {
'use strict';
$('.burger').on('click', function () {
body.toggleClass('canvas-opened');
});
2019-04-29 19:46:11 +03:00
}