Blog: Re-order hideOverlay to be re-used

This commit is contained in:
2017-01-20 13:13:11 +01:00
parent 350577033c
commit 85dba5e9e9
5 changed files with 56 additions and 42 deletions

View File

@@ -123,6 +123,24 @@ meta(name="twitter:description", content="{{ node.properties.content }}")
| {% block footer_scripts %}
include ../_scripts
script hopToTop(); // Display jump to top button
script.
hopToTop(); // Display jump to top button
/* Expand images when their link points to a jpg/png/gif */
/* TODO: De-duplicate code from view post */
var page_overlay = document.getElementById('page-overlay');
$('.blog_index-item .item-content a img').on('click', function(e){
e.preventDefault();
var href = $(this).parent().attr('href');
var src = $(this).attr('src');
if (href.match("jpg$") || href.match("png$") || href.match("gif$")) {
$(page_overlay)
.addClass('active')
.html('<img src="' + src + '"/>');
} else {
window.location.href = href;
}
});
| {% endblock %}