₊⁺✿˚
This commit is contained in:
parent
22395cfb90
commit
0fd805d748
|
@ -0,0 +1,79 @@
|
|||
// npf photoset styling by @glenthemes
|
||||
// npf photoset lightboxes by @codematurgy
|
||||
var npfOptions = {
|
||||
rowClass:"npf_row",
|
||||
imageContainerClass:"tmblr-full",
|
||||
generatedPhotosetContainerClass:"npf_photoset",
|
||||
imageClass:"npf_image",
|
||||
includeCommonPhotosets: true,
|
||||
useTumblrLightbox: true,
|
||||
insertGalleryIndicator: false,
|
||||
galleryIndicatorClass: "npf_gallery_indicator",
|
||||
galleryIndicatorContent: "<img src='image_url'>",
|
||||
photosetMargins:""
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".npf_row").each(function(){
|
||||
npf_img = $(this).find("img");
|
||||
npf_rowHeight = Math.max.apply(
|
||||
Math, npf_img.map(function(){
|
||||
return $(this).height();
|
||||
}).get());
|
||||
|
||||
var spacing = getComputedStyle(document.documentElement)
|
||||
.getPropertyValue("--NPF-Image-Spacing");
|
||||
var sparce = parseInt(spacing);
|
||||
|
||||
var maxh = Math.floor(npf_rowHeight + (sparce * 2));
|
||||
|
||||
$(this).css({"max-height":maxh});
|
||||
});
|
||||
|
||||
$(".tmblr-full").each(function(){
|
||||
if (!$(this).parent().is(".npf_row")) {
|
||||
$(this).wrap( "<div class='npf_row'></div>" );
|
||||
}
|
||||
|
||||
$(this).css({"text-align":"left"});
|
||||
});
|
||||
|
||||
$(".tmblr-full img").each(function(i, npf){
|
||||
var npf_img = $(npf);
|
||||
var create_div = $("<div>").css({
|
||||
"background-image":"url(" + npf_img.attr("src") + ")",
|
||||
"background-repeat":"no-repeat",
|
||||
"background-size":"cover",
|
||||
"background-position":"center",
|
||||
"width":npf_img.width() + "px",
|
||||
"height":npf_img.height() + "px",
|
||||
});
|
||||
npf_img.after(create_div);
|
||||
});
|
||||
|
||||
$(".tmblr-full img").each(function(i, npf){
|
||||
var npf_img = $(npf);
|
||||
npf_img.width(npf_img.width());
|
||||
npf_img.css({
|
||||
"position":"absolute",
|
||||
"visibility":"visible",
|
||||
"opacity":"0"
|
||||
});
|
||||
});
|
||||
|
||||
// if image fails to get height
|
||||
$(".tmblr-full div").each(function(i, npf){
|
||||
var npf_div = $(npf);
|
||||
if ((npf_div.height()) == 0) {
|
||||
npf_div.hide();
|
||||
npf_div.siblings("img").css({
|
||||
"position":"relative",
|
||||
"opacity":"1"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".tmblr-full").css({"cursor":"auto"});
|
||||
$(".npf_photoset img").css({"cursor":"pointer"});
|
||||
|
||||
});// end docready
|
Loading…
Reference in New Issue