Initial commit xmarticaims
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/* Enter starts hidden and transitions in after the first paint.
|
||||
A CSS animation would finish during head scripts (Tailwind CDN) before anything is visible. */
|
||||
|
||||
body {
|
||||
opacity: 0;
|
||||
transform: translateY(30px) scale(0.99);
|
||||
filter: blur(7px);
|
||||
transition:
|
||||
opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
|
||||
transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
|
||||
filter 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
|
||||
}
|
||||
|
||||
body.is-entered {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
body.is-leaving {
|
||||
opacity: 0;
|
||||
transform: translateY(-22px) scale(0.985);
|
||||
filter: blur(5px);
|
||||
transition:
|
||||
opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
filter 0.4s;
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
body {
|
||||
transform: translateY(16px);
|
||||
filter: none;
|
||||
}
|
||||
|
||||
body.is-leaving {
|
||||
filter: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
body {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
filter: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
body.is-leaving {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
filter: none;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/* Cinematic page transition (from trivelta-html).
|
||||
WordPress prints internal links as absolute URLs, so same-origin navigations
|
||||
are included. External, in-page, admin, and modified clicks are left alone. */
|
||||
(function () {
|
||||
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
var leaveMs = 360;
|
||||
|
||||
function playEnter() {
|
||||
if (reduceMotion) {
|
||||
document.body.classList.add('is-entered');
|
||||
return;
|
||||
}
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
requestAnimationFrame(function () {
|
||||
document.body.classList.add('is-entered');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (/(?:^|[?&])(ct_builder|oxygen_iframe|ct_inner)=/.test(window.location.search)) {
|
||||
document.body.classList.add('is-entered');
|
||||
return;
|
||||
}
|
||||
|
||||
playEnter();
|
||||
|
||||
function shouldSkip(anchor, event) {
|
||||
if (!anchor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.defaultPrevented || event.button) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((anchor.target && anchor.target !== '_self') || anchor.hasAttribute('download')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var href = anchor.getAttribute('href');
|
||||
|
||||
if (!href || href.charAt(0) === '#' || /^(mailto:|tel:|javascript:)/i.test(href)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var url;
|
||||
|
||||
try {
|
||||
url = new URL(anchor.href, window.location.href);
|
||||
} catch (error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.origin !== window.location.origin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.pathname.indexOf('/wp-admin') !== -1 || /\/wp-(login|comments-post)\.php$/.test(url.pathname)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (/\.(pdf|zip|rar|7z|docx?|xlsx?|pptx?|jpe?g|png|gif|webp|svg|mp[34]|wav)(\?|$)/i.test(url.pathname)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.pathname === window.location.pathname && url.search === window.location.search) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function go(url) {
|
||||
if (document.body.classList.contains('is-leaving')) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.body.classList.add('is-leaving');
|
||||
window.setTimeout(function () {
|
||||
window.location.href = url;
|
||||
}, reduceMotion ? 0 : leaveMs);
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
var anchor = event.target.closest ? event.target.closest('a') : null;
|
||||
|
||||
if (shouldSkip(anchor, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
go(anchor.href);
|
||||
});
|
||||
|
||||
window.addEventListener('pageshow', function () {
|
||||
document.body.classList.remove('is-leaving');
|
||||
});
|
||||
}());
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Cinematic page transition.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_page_transition_assets() {
|
||||
$dir = get_template_directory() . '/parts/page-transition';
|
||||
$uri = get_template_directory_uri() . '/parts/page-transition';
|
||||
|
||||
wp_enqueue_style(
|
||||
'alcastromol-page-transition',
|
||||
$uri . '/page-transition.css',
|
||||
array(),
|
||||
filemtime( $dir . '/page-transition.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'alcastromol-page-transition',
|
||||
$uri . '/page-transition.js',
|
||||
array(),
|
||||
filemtime( $dir . '/page-transition.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
function alcastromol_page_transition_noscript() {
|
||||
echo '<noscript><style>body{opacity:1!important;transform:none!important;filter:none!important}</style></noscript>';
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'alcastromol_page_transition_assets' );
|
||||
add_action( 'wp_head', 'alcastromol_page_transition_noscript', 20 );
|
||||
Reference in New Issue
Block a user