This commit is contained in:
alphaAE
2022-07-16 03:19:14 +08:00
parent c749c7191f
commit bd4b3ed771
89 changed files with 6990 additions and 18 deletions

146
public/js/scripts.js Normal file
View File

@ -0,0 +1,146 @@
/*!
Title: Dev Portfolio Template
Version: 1.2.2
Last Change: 03/25/2020
Author: Ryan Fitzgerald
Repo: https://github.com/RyanFitzgerald/devportfolio-template
Issues: https://github.com/RyanFitzgerald/devportfolio-template/issues
Description: This file contains all the scripts associated with the single-page
portfolio website.
*/
(function($) {
// Show current year
$('#current-year').text(new Date().getFullYear())
// Remove no-js class
$('html').removeClass('no-js')
// Animate to section when nav is clicked
$('header a').click(function (e) {
// Treat as normal link if no-scroll class
if ($(this).hasClass('no-scroll')) return
e.preventDefault()
var heading = $(this).attr('href')
var scrollDistance = $(heading).offset().top
$('html, body').animate(
{
scrollTop: scrollDistance + 'px',
},
Math.abs(window.pageYOffset - $(heading).offset().top) / 1
)
// Hide the menu once clicked if mobile
if ($('header').hasClass('active')) {
$('header, body').removeClass('active')
}
})
// Scroll to top
$('#to-top').click(function () {
$('html, body').animate(
{
scrollTop: 0,
},
500
)
})
// Scroll to first element
$('#lead-down span').click(function () {
var scrollDistance = $('#lead').next().offset().top
$('html, body').animate(
{
scrollTop: scrollDistance + 'px',
},
500
)
})
// Create timeline
$('#experience-timeline').each(function () {
$this = $(this) // Store reference to this
$userContent = $this.children('div') // user content
// Create each timeline block
$userContent.each(function () {
$(this)
.addClass('vtimeline-content')
.wrap(
'<div class="vtimeline-point"><div class="vtimeline-block"></div></div>'
)
})
// Add icons to each block
$this.find('.vtimeline-point').each(function () {
$(this).prepend(
'<div class="vtimeline-icon"><i class="fa fa-map-marker"></i></div>'
)
})
// Add dates to the timeline if exists
$this.find('.vtimeline-content').each(function () {
var date = $(this).data('date')
if (date) {
// Prepend if exists
$(this)
.parent()
.prepend('<span class="vtimeline-date">' + date + '</span>')
}
})
})
// Open mobile menu
$('#mobile-menu-open').click(function () {
$('header, body').addClass('active')
})
// Close mobile menu
$('#mobile-menu-close').click(function () {
$('header, body').removeClass('active')
})
// Load additional projects
$('#view-more-projects').click(function (e) {
e.preventDefault()
$(this).fadeOut(300, function () {
$('#more-projects').fadeIn(300)
})
})
// projecct image viewer
$('.project-image .image').click(function () {
$('#full-image').attr('src', $(this).attr('alt'))
$('#image-viewer').show()
})
$('#image-viewer .close').click(function () {
$('#image-viewer').hide()
})
// projecct video viewer
$('.project-video .image').click(function () {
console.log('click')
$('#full-video').attr('src', $(this).attr('alt'))
$('#video-viewer').show()
})
$('#video-viewer .close').click(function () {
$('#video-viewer').hide()
})
// projecct glb viewer
$('.project-glb .image').click(function () {
console.log('click')
$('#full-glb').attr('src', $(this).attr('alt'))
$('#glb-viewer').show()
})
$('#glb-viewer .close').click(function () {
$('#glb-viewer').hide()
})
})(jQuery);

12
public/js/scripts.min.js vendored Normal file
View File

@ -0,0 +1,12 @@
/*!
Title: Dev Portfolio Template
Version: 1.2.2
Last Change: 03/25/2020
Author: Ryan Fitzgerald
Repo: https://github.com/RyanFitzgerald/devportfolio-template
Issues: https://github.com/RyanFitzgerald/devportfolio-template/issues
Description: This file contains all the scripts associated with the single-page
portfolio website.
*/
!function(c){c("#current-year").text((new Date).getFullYear()),c("html").removeClass("no-js"),c("header a").click(function(e){if(!c(this).hasClass("no-scroll")){e.preventDefault();var i=c(this).attr("href"),t=c(i).offset().top;c("html, body").animate({scrollTop:t+"px"},+Math.abs(window.pageYOffset-c(i).offset().top)),c("header").hasClass("active")&&c("header, body").removeClass("active")}}),c("#to-top").click(function(){c("html, body").animate({scrollTop:0},500)}),c("#lead-down span").click(function(){var e=c("#lead").next().offset().top;c("html, body").animate({scrollTop:e+"px"},500)}),c("#experience-timeline").each(function(){$this=c(this),$userContent=$this.children("div"),$userContent.each(function(){c(this).addClass("vtimeline-content").wrap('<div class="vtimeline-point"><div class="vtimeline-block"></div></div>')}),$this.find(".vtimeline-point").each(function(){c(this).prepend('<div class="vtimeline-icon"><i class="fa fa-map-marker"></i></div>')}),$this.find(".vtimeline-content").each(function(){var e=c(this).data("date");e&&c(this).parent().prepend('<span class="vtimeline-date">'+e+"</span>")})}),c("#mobile-menu-open").click(function(){c("header, body").addClass("active")}),c("#mobile-menu-close").click(function(){c("header, body").removeClass("active")}),c("#view-more-projects").click(function(e){e.preventDefault(),c(this).fadeOut(300,function(){c("#more-projects").fadeIn(300)})}),c(".project-image .image").click(function(){c("#full-image").attr("src",c(this).attr("alt")),c("#image-viewer").show()}),c("#image-viewer .close").click(function(){c("#image-viewer").hide()}),c(".project-video .image").click(function(){console.log("click"),c("#full-video").attr("src",c(this).attr("alt")),c("#video-viewer").show()}),c("#video-viewer .close").click(function(){c("#video-viewer").hide()}),c(".project-glb .image").click(function(){console.log("click"),c("#full-glb").attr("src",c(this).attr("alt")),c("#glb-viewer").show()}),c("#glb-viewer .close").click(function(){c("#glb-viewer").hide()})}(jQuery);