Files
loicgentil.fr/assets/js/script.js
2025-06-25 15:43:30 +02:00

364 lines
7.3 KiB
JavaScript

$(document).ready(function () {
"use strict";
//Copyright Date
// var newYear = document.getElementById("newYear");
// newYear.innerHTML = new Date().getFullYear();
// Scroll to top
$("a[href='#top']").click(function () {
$("html, body").animate(
{
scrollTop: 0,
},
"slow"
);
return false;
});
// Smooth scroll
$("a.scroll-to").on("click", function (event) {
$("html, body")
.stop()
.animate(
{
scrollTop: $(this.hash).offset().top - 50,
},
1000
);
event.preventDefault();
if (screen.width < 992) {
$(".navbar-toggler").click();
}
});
// AOS initialize
AOS.init({
disable: "mobile",
});
// Service Item Match Height
$(".service-item").matchHeight({
byRow: 0,
});
// .blog-content Match Height
$(".blog-content").matchHeight({
byRow: 0,
});
$(".story-slider").slick({
dots: true,
infinite: true,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
autoplay: true,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 768,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
$(".quotes-slider").slick({
dots: true,
infinite: true,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
autoplay: true,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 768,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
$(".clients-slider").slick({
dots: true,
infinite: true,
speed: 300,
slidesToShow: 4,
slidesToScroll: 1,
arrows: false,
autoplay: true,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 768,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
$(".popup-youtube, .popup-vimeo, .popup-gmaps").magnificPopup({
disableOn: 700,
type: "iframe",
mainClass: "mfp-fade",
removalDelay: 160,
preloader: false,
fixedContentPos: false,
});
// Magnific Gallery
$(".gallery").magnificPopup({
delegate: "a",
type: "image",
closeOnContentClick: false,
closeBtnInside: false,
mainClass: "mfp-with-zoom mfp-img-mobile",
image: {
verticalFit: true,
titleSrc: function (item) {
return (
item.el.attr("title") +
' &middot; <a class="image-source-link" href="' +
item.el.attr("data-source") +
'" target="_blank">image source</a>'
);
},
},
gallery: {
enabled: true,
},
zoom: {
enabled: true,
duration: 300, // don't foget to change the duration also in CSS
opener: function (element) {
return element.find("img");
},
},
});
});
// Add nav bg
$(window).on("scroll", function () {
if ($(window).scrollTop()) {
$(".main-nav").addClass("nav-bg");
} else {
$(".main-nav").removeClass("nav-bg");
}
});
// G-Map
/**
* Created by Kausar on 06/10/2016.
*/
window.marker = null;
function initialize() {
var map;
var lat = $("#map").data("lat");
var long = $("#map").data("long");
console.log(lat, long);
var mapCenter = new google.maps.LatLng(lat, long);
var style = [
{
"featureType": "all",
"elementType": "geometry",
"stylers": [
{
"color": "#202c3e"
}
]
},
{
"featureType": "all",
"elementType": "labels.text.fill",
"stylers": [
{
"gamma": 0.01
},
{
"lightness": 20
},
{
"weight": "1.39"
},
{
"color": "#ffffff"
}
]
},
{
"featureType": "all",
"elementType": "labels.text.stroke",
"stylers": [
{
"weight": "0.96"
},
{
"saturation": "9"
},
{
"visibility": "on"
},
{
"color": "#000000"
}
]
},
{
"featureType": "all",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "landscape",
"elementType": "geometry",
"stylers": [
{
"lightness": 30
},
{
"saturation": "9"
},
{
"color": "#29446b"
}
]
},
{
"featureType": "poi",
"elementType": "geometry",
"stylers": [
{
"saturation": 20
}
]
},
{
"featureType": "poi.park",
"elementType": "geometry",
"stylers": [
{
"lightness": 20
},
{
"saturation": -20
}
]
},
{
"featureType": "road",
"elementType": "geometry",
"stylers": [
{
"lightness": 10
},
{
"saturation": -30
}
]
},
{
"featureType": "road",
"elementType": "geometry.fill",
"stylers": [
{
"color": "#193a55"
}
]
},
{
"featureType": "road",
"elementType": "geometry.stroke",
"stylers": [
{
"saturation": 25
},
{
"lightness": 25
},
{
"weight": "0.01"
}
]
},
{
"featureType": "water",
"elementType": "all",
"stylers": [
{
"lightness": -20
}
]
}
];
var mapOptions = {
// SET THE CENTER
center: mapCenter,
// SET THE MAP STYLE & ZOOM LEVEL
mapTypeId: google.maps.MapTypeId.ROADMAP,
// REMOVE ALL THE CONTROLS EXCEPT ZOOM
zoom: 12,
panControl: false,
scrollwheel: false,
zoomControl: true,
mapTypeControl: false,
scaleControl: false,
streetViewControl: false,
overviewMapControl: false,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
},
};
map = new google.maps.Map(document.getElementById("map"), mapOptions);
// SET THE MAP TYPE
var mapType = new google.maps.StyledMapType(style, {
name: "Grayscale",
});
map.mapTypes.set("grey", mapType);
map.setMapTypeId("grey");
//CREATE A CUSTOM PIN ICON
var marker_image = $("#map").data("pin");
var pinIcon = new google.maps.MarkerImage(
marker_image,
null,
null,
null
);
marker = new google.maps.Marker({
position: mapCenter,
map: map,
icon: pinIcon,
title: "CoHub",
});
}
if ($("#map").length > 0) {
google.maps.event.addDomListener(window, "load", initialize);
}