banner



How To Animate The Direction Of A Solid

Seamless blithe page transitions in Jekyll with Animate.css

  • I am just a front end dev enthusiast — coding isn't something I exercise oftentimes then the learning curve would be pretty steep
  • I've congenital this project using Jekyll — static pages could be a serious issue and i didn't want to build a carousel where all posts are loaded on to each summary folio making the site huge
  • Animating content + gestures with static folio posts and background color changes — I had no thought where to commencement.

Blueprint

Getting on with JS via Zepto

          <script src="../js/zepto.min.js" type="text/javascript"></script>
<script src="../js/affect.js" type="text/javascript"></script>
<script src="../js/scripts.js" blazon="text/javascript"></script>

Adding basic animation

          <caput>
<link rel="stylesheet" href="../css/animate.min.css">
</head>
          $('#next-post').click(function () {                      $('#adjacent-postal service').parent().parent().addClass('slideOutLeft');
$(".wrap").addClass('fadeOut');
}); $('#prev-post').click(role () { $('#prev-post').parent().parent().addClass('slideOutRight');
$(".wrap").addClass('fadeOut');
});
          $('#prev-post').click(function (e) {                      var t    = this,          //shop the href for the clicked element

href = t.href;

//prevent the default behavior e.preventDefault(); //apply the fade out transition form to the container and wrap $(t).parent().parent().addClass('slideOutRight');
$(".wrap").addClass('fadeOut');
//setTimeout to wait for fade out blitheness to complete before changing pages setTimeout(role (){ window.location = href;}, 350);

//the length of fourth dimension should vary depending on the length of the blitheness.

});
  • I want to accept seamless smooth transitions between 2 post pages ; requires animations on destination folio to complete the transition
  • I want this to be a touch on gesture interactions and so users could simply swipe left and right to navigate betwixt next / previous postal service
  • I want the transition to be direction aware, which is problematic since there is no way of telling if user came from previous or side by side mail relatively and the fade slide animation direction of those would be in opposite.
          certificate.referrer;        
                      var referrer =  document.referrer;                      if(referrer == '{{site.url}}{{folio.previous.url}}'){
$('.postal service-container').addClass('slideInLeft');
} else {
$('.post-container').addClass('slideInRight');
}

          // Listing of categories
$categorys: (website: deep-orangish, ui: cyan, ux: amber, product: ruby, brand: blueish );
// Loop over list of categories
// @each ( $category : $color )
@each $category, $colour in $categorys { .category{
&.#{$category} {
groundwork-colour: fabric-color('#{$colour}', '500');
color: #ffffff;
}
}
.wrap{
&.#{$category} {
@include linear-gradient(material-colour('#{$colour}', '300'), cloth-color('#{$color}', '200') );
.image-container{
@include linear-gradient(material-color('#{$color}', '300'), material-color('#{$color}', '700') );
}
}
}
.list-item{
&.#{$category}{
@include transition(background 0.3s ease-in);
&:hover{
@include linear-gradient(-135deg, fabric-color('#{$colour}', '50'), #ffffff, #ffffff);
edge-correct: 3px solid material-color('#{$color}', '500');
border-bottom-color: material-color('#{$color}', '500');
@include transition(groundwork 0.4s ease-in);
}
.paradigm{
background-color: material-color('#{$color}', '500');
}
}
}
.post-management{
&.#{$category}{
@include transition(background 0.4s ease-in);
&:hover{
border-bottom: 3px solid material-color('#{$color}', '500');
@include transition(edge 0.2s ease-in);
.mail service-direction-championship{
edge-lesser-colour: material-color('#{$color}', '500');
h6{
colour: fabric-colour('#{$color}', '500');
}
.pointer{
fill up: fabric-color('#{$color}', '500');
}
}
}
}
}
}

          $(certificate).ready(function() {          //touch swipe gestures
$(".mail-box").swipeLeft(function () {
$(".mail-box").addClass('slideOutLeft');
$(".wrap").addClass('fadeOut');
setTimeout(function (){
window.location = '{{site.url}}{{folio.previous.url}}';
}, 100);
}); $(".post-box").swipeRight(function () { $(".post-box").addClass('slideOutRight');
$(".wrap").addClass('fadeOut');
setTimeout(function (){
window.location = '{{site.url}}{{page.next.url}}';
}, 100);
}); // folio order aware sliding
var referrer = certificate.referrer;
if(referrer == '{{site.url}}{{page.previous.url}}'){
$('.post-container').addClass('slideInLeft');
} else {
$('.mail-container').addClass('slideInRight');
}
});

Conclusion

Cheers for reading!

If yous liked this article please evidence some ❤️ and 👏

Source: https://medium.com/@ntnlbd/direction-aware-navigation-animations-in-jekyll-with-animate-css-zepto-fca9018470be

Posted by: keeleycopichatte59.blogspot.com

0 Response to "How To Animate The Direction Of A Solid"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel