element loading transitions

This commit is contained in:
ManjaroOne666 2019-02-02 13:53:19 +00:00
parent 56e1b53140
commit 0ac393b3c0
4 changed files with 59 additions and 12 deletions

View File

@ -1,6 +1,4 @@
## General ## General
* loading transitions
- also transitioning elements in when page loads (especially gallery thumbs in gallery)
* image urls, page links, social nav items, etc -> put in store or whatever * image urls, page links, social nav items, etc -> put in store or whatever
* facebook/twitter social card thingies * facebook/twitter social card thingies
* favicon * favicon

View File

@ -1,7 +1,9 @@
<template> <template>
<article class="content-page"> <article class="content-page"
:class="{ 'is-mounted': isMounted }"
>
<h1 v-if="heading !== ''" class="page-heading page-title">{{ heading }}</h1> <h1 v-if="heading !== ''" class="page-heading page-title">{{ heading }}</h1>
<section class="content-container"> <section class="content-container load-transition">
<div v-if="$slots.default" class="content"> <div v-if="$slots.default" class="content">
<slot></slot> <slot></slot>
</div> </div>
@ -24,12 +26,15 @@ export default {
data () { data () {
return { return {
isMounted: false,
} }
}, },
methods: { mounted () {
} this.$nextTick(() => {
this.isMounted = true
})
},
} }
</script> </script>
@ -111,4 +116,13 @@ $z-index-top: 10;
opacity: 1; opacity: 1;
} }
} }
.load-transition {
transition: 2s 2s;
opacity: 0;
@at-root .is-mounted & {
opacity: 1;
}
}
</style> </style>

View File

@ -1,5 +1,7 @@
<template> <template>
<div class="gallery-page"> <div class="gallery-page"
:class="{'is-mounted': isMounted }"
>
<GalleryImageViewer class="image-viewer" <GalleryImageViewer class="image-viewer"
ref="imageViewer" ref="imageViewer"
:is-visible="imageViewerIsVisible" :is-visible="imageViewerIsVisible"
@ -11,11 +13,11 @@
@close="imageViewerIsVisible = false" /> @close="imageViewerIsVisible = false" />
<article class="gallery"> <article class="gallery">
<h1 class="page-heading page-title">My Galleries</h1> <h1 class="page-heading page-title">My Galleries</h1>
<GalleryFeatured class="gallery__featured" <GalleryFeatured class="gallery__featured load-transition load-transition--1"
:galleries="galleries" :galleries="galleries"
:gallery-active="activeGalleryIndex" :gallery-active="activeGalleryIndex"
@clicked="handleFeaturedClick" /> @clicked="handleFeaturedClick" />
<GalleryThumbs class="gallery__thumbs" <GalleryThumbs class="gallery__thumbs load-transition load-transition--2"
:featured-height="featuredImageHeight" :featured-height="featuredImageHeight"
:galleries="galleries" :galleries="galleries"
:active-row="activeRow" :active-row="activeRow"
@ -47,6 +49,7 @@ export default {
data () { data () {
return { return {
isMounted: false,
featuredImageHeight: '16rem', featuredImageHeight: '16rem',
imageViewerIsVisible: false, imageViewerIsVisible: false,
activeRow: 0, activeRow: 0,
@ -100,6 +103,9 @@ export default {
mounted () { mounted () {
window.addEventListener('resize', () => { this.imageViewerIsVisible = false }) window.addEventListener('resize', () => { this.imageViewerIsVisible = false })
this.$nextTick(() => {
this.isMounted = true
})
}, },
methods: { methods: {
@ -252,4 +258,21 @@ export default {
} }
.load-transition {
transition: opacity 2s;
opacity: 0;
&--1 {
transition-delay: 2s;
}
&--2 {
transition-delay: 3s;
}
@at-root .is-mounted & {
opacity: 1;
}
}
</style> </style>

View File

@ -1,5 +1,7 @@
<template> <template>
<section :class="{ 'is-open': isOpen }" <section :class="{ 'is-open': isOpen,
'is-mounted': isMounted
}"
class="menu-drawer menu-layout" class="menu-drawer menu-layout"
> >
<div class="menu-header__item menu-toggle" <div class="menu-header__item menu-toggle"
@ -79,6 +81,7 @@ export default {
data () { data () {
return { return {
isMounted: false, //component has loaded
loadMenuImages: true, loadMenuImages: true,
siteNav: [ siteNav: [
{ 'to': '/', 'text': 'Home', bgImgUrl: '/img/devices--bw.jpg'}, { 'to': '/', 'text': 'Home', bgImgUrl: '/img/devices--bw.jpg'},
@ -99,6 +102,9 @@ export default {
mounted () { mounted () {
const mq = window.matchMedia("(min-width: 40em)") const mq = window.matchMedia("(min-width: 40em)")
this.loadMenuImages = mq.matches this.loadMenuImages = mq.matches
this.$nextTick(() => {
this.isMounted = true
})
}, },
} }
</script> </script>
@ -266,7 +272,13 @@ $transition-timing: .5s;
font-size: 0.9rem; font-size: 0.9rem;
text-transform: uppercase; text-transform: uppercase;
line-height: 1.1; line-height: 1.1;
transition: opacity 2s 1s;
opacity: 0;
@at-root .is-mounted & {
opacity: .8; opacity: .8;
}
@include font-title($weight: 400); @include font-title($weight: 400);