Fix line spacing.
Automatically by Visual Code Studio.
This commit is contained in:
parent
7cdd0e0b3d
commit
84843f40f9
@ -14,7 +14,7 @@ var main = {
|
|||||||
$(".navbar").removeClass("top-nav-short");
|
$(".navbar").removeClass("top-nav-short");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// On mobile, hide the avatar when expanding the navbar menu
|
// On mobile, hide the avatar when expanding the navbar menu
|
||||||
$('#main-navbar').on('show.bs.collapse', function () {
|
$('#main-navbar').on('show.bs.collapse', function () {
|
||||||
$(".navbar").addClass("top-nav-expanded");
|
$(".navbar").addClass("top-nav-expanded");
|
||||||
@ -22,7 +22,7 @@ var main = {
|
|||||||
$('#main-navbar').on('hidden.bs.collapse', function () {
|
$('#main-navbar').on('hidden.bs.collapse', function () {
|
||||||
$(".navbar").removeClass("top-nav-expanded");
|
$(".navbar").removeClass("top-nav-expanded");
|
||||||
});
|
});
|
||||||
|
|
||||||
// On mobile, when clicking on a multi-level navbar menu, show the child links
|
// On mobile, when clicking on a multi-level navbar menu, show the child links
|
||||||
$('#main-navbar').on("click", ".navlinks-parent", function(e) {
|
$('#main-navbar').on("click", ".navlinks-parent", function(e) {
|
||||||
var target = e.target;
|
var target = e.target;
|
||||||
@ -60,12 +60,12 @@ var main = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
fakeMenu.remove();
|
fakeMenu.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the big header image
|
// show the big header image
|
||||||
main.initImgs();
|
main.initImgs();
|
||||||
},
|
},
|
||||||
|
|
||||||
initImgs : function() {
|
initImgs : function() {
|
||||||
// If the page was large images to randomly select from, choose an image
|
// If the page was large images to randomly select from, choose an image
|
||||||
if ($("#header-big-imgs").length > 0) {
|
if ($("#header-big-imgs").length > 0) {
|
||||||
@ -78,57 +78,57 @@ var main = {
|
|||||||
var src = imgInfo.src;
|
var src = imgInfo.src;
|
||||||
var desc = imgInfo.desc;
|
var desc = imgInfo.desc;
|
||||||
main.setImg(src, desc);
|
main.setImg(src, desc);
|
||||||
|
|
||||||
// For better UX, prefetch the next image so that it will already be loaded when we want to show it
|
// For better UX, prefetch the next image so that it will already be loaded when we want to show it
|
||||||
var getNextImg = function() {
|
var getNextImg = function() {
|
||||||
var imgInfo = main.getImgInfo();
|
var imgInfo = main.getImgInfo();
|
||||||
var src = imgInfo.src;
|
var src = imgInfo.src;
|
||||||
var desc = imgInfo.desc;
|
var desc = imgInfo.desc;
|
||||||
|
|
||||||
var prefetchImg = new Image();
|
var prefetchImg = new Image();
|
||||||
prefetchImg.src = src;
|
prefetchImg.src = src;
|
||||||
// if I want to do something once the image is ready: `prefetchImg.onload = function(){}`
|
// if I want to do something once the image is ready: `prefetchImg.onload = function(){}`
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
var img = $("<div></div>").addClass("big-img-transition").css("background-image", 'url(' + src + ')');
|
var img = $("<div></div>").addClass("big-img-transition").css("background-image", 'url(' + src + ')');
|
||||||
$(".intro-header.big-img").prepend(img);
|
$(".intro-header.big-img").prepend(img);
|
||||||
setTimeout(function(){ img.css("opacity", "1"); }, 50);
|
setTimeout(function(){ img.css("opacity", "1"); }, 50);
|
||||||
|
|
||||||
// after the animation of fading in the new image is done, prefetch the next one
|
// after the animation of fading in the new image is done, prefetch the next one
|
||||||
//img.one("transitioned webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){
|
//img.one("transitioned webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
main.setImg(src, desc);
|
main.setImg(src, desc);
|
||||||
img.remove();
|
img.remove();
|
||||||
getNextImg();
|
getNextImg();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
//});
|
//});
|
||||||
}, 6000);
|
}, 6000);
|
||||||
};
|
};
|
||||||
|
|
||||||
// If there are multiple images, cycle through them
|
// If there are multiple images, cycle through them
|
||||||
if (main.numImgs > 1) {
|
if (main.numImgs > 1) {
|
||||||
getNextImg();
|
getNextImg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getImgInfo : function() {
|
getImgInfo : function() {
|
||||||
var randNum = Math.floor((Math.random() * main.numImgs) + 1);
|
var randNum = Math.floor((Math.random() * main.numImgs) + 1);
|
||||||
var src = main.bigImgEl.attr("data-img-src-" + randNum);
|
var src = main.bigImgEl.attr("data-img-src-" + randNum);
|
||||||
var desc = main.bigImgEl.attr("data-img-desc-" + randNum);
|
var desc = main.bigImgEl.attr("data-img-desc-" + randNum);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
src : src,
|
src : src,
|
||||||
desc : desc
|
desc : desc
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setImg : function(src, desc) {
|
setImg : function(src, desc) {
|
||||||
$(".intro-header.big-img").css("background-image", 'url(' + src + ')');
|
$(".intro-header.big-img").css("background-image", 'url(' + src + ')');
|
||||||
if (typeof desc !== typeof undefined && desc !== false) {
|
if (typeof desc !== typeof undefined && desc !== false) {
|
||||||
$(".img-desc").text(desc).show();
|
$(".img-desc").text(desc).show();
|
||||||
} else {
|
} else {
|
||||||
$(".img-desc").hide();
|
$(".img-desc").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user