Blog: Expand images when clicking on them (and the link is an image)
Duplicated in both index/view post to get it out for today's Cycles post, wrote a note to fix this.
This commit is contained in:
parent
eb5fb4eb09
commit
350577033c
@ -133,4 +133,21 @@ script.
|
||||
}
|
||||
});
|
||||
|
||||
/* Expand images when their link points to a jpg/png/gif */
|
||||
/* TODO: De-duplicate code from view post */
|
||||
$('.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$")) {
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
$(page_overlay)
|
||||
.addClass('active')
|
||||
.html('<img src="' + src + '"/>');
|
||||
} else {
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
| {% endblock %}
|
||||
|
@ -105,4 +105,21 @@ script.
|
||||
}
|
||||
});
|
||||
|
||||
/* Expand images when their link points to a jpg/png/gif */
|
||||
/* TODO: De-duplicate code from blog index */
|
||||
$('.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$")) {
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
$(page_overlay)
|
||||
.addClass('active')
|
||||
.html('<img src="' + src + '"/>');
|
||||
} else {
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
| {% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user