» » Beautiful page transition animation

 

Beautiful page transition animation

Author: bamboo06 on 23-06-2016, 00:03, views: 1248

16
By clicking the menu on side of the page it is loaded along with the corresponding slide transition animations, but also with the progress bar effect. Of course, the page loaded is driven by Ajax, the entire loading process of transition is very smooth, with very good user experience.


HTML
HTML structure, .cd-main body of the page contains content, .cd-side-navigation contains the side navigation bar, # cd-loading-bar is used to make a progress bar with animation.
<nav class="cd-side-navigation"> 
    <ul> 
        <li> 
            <a href="index.html" class="selected" data-menu="index"> 
                <svg><!-- svg content here --></svg> 
                Intro 
            </a> 
        </li> 
  
        <li> 
            <!-- ... --> 
        </li> 
  
        <!-- other list items here --> 
    </ul> 
</nav> <!-- .cd-dashboard --> 
  
<main class="cd-main"> 
    <section class="cd-section index visible"> 
        <header> 
            <div class="cd-title"> 
                <h2>Animated Page Transition #2</h2> 
                <span>Some text here</span> 
            </div> 
             
            <a href="#index-content" class="cd-scroll">Scroll Down</a> 
        </header> 
  
        <div class="cd-content" id="index-content"> 
            <!-- content here --> 
        </div> <!-- .cd-content --> 
    </section> <!-- .cd-section --> 
</main> <!-- .cd-main --> 
  
<div id="cd-loading-bar" data-scale="1" class="index"></div> <!-- lateral loading bar --> 


CSS
We will fix .cd-side-navigation on the left side of the page, and set its height to 100%, so it has always occupied the left navigation menu on the left sidebar, when the right side of the main content of the scroll, the left navigation menu does not move.
.cd-side-navigation { 
 position: fixed; 
 z-index: 3; 
 top: 0; 
 left: 0; 
 height: 100vh; 
 width: 94px; 
 overflow: hidden; 
} 
.cd-side-navigation ul { 
 height: 100%; 
 overflow-y: auto; 
} 
.cd-side-navigation::before { 
 /* background color of the side navigation */ 
 content: ''; 
 position: absolute; 
 top: 0; 
 left: 0; 
 height: 100%; 
 width: calc(100% - 4px); 
 background-color: #131519; 
} 
.cd-side-navigation li { 
 width: calc(100% - 4px); 
} 
.cd-side-navigation a { 
 display: block; 
 position: relative; 
} 
.cd-side-navigation a::after { 
 /* 4px line to the right of the item - visible on hover */ 
 content: ''; 
 position: absolute; 
 top: 0; 
 right: -4px; 
 height: 100%; 
 width: 4px; 
 background-color: #83b0b9; 
 opacity: 0; 
} 
.no-touch .cd-side-navigation a:hover::after { 
 opacity: 1; 
} 


javascript
When we click on the left menu, call triggerAnimation () function, which will trigger the loading progress bar animation function loadingBarAnimation (), then load the page content functions: loadNewContent ().
function loadingBarAnimation() { 
    var scaleMax = loadingBar.data('scale'); 
    if( scaleY + 1 < scaleMax) { 
        newScaleValue = scaleY + 1; 
    }  
    // ... 
     
    loadingBar.velocity({ 
        scaleY: newScaleValue 
    }, 100, loadingBarAnimation); 
} 

When a new page is selected, a new element .cd-section will be created and inserted into the DOM, and then load () new url content.
function loadNewContent(newSection) { 
    var section = $('<section class="cd-section overflow-hidden '+newSection+'"></section>').appendTo(mainContent); 
     
    //load the new content from the proper html file 
    section.load(newSection+'.html .cd-section > *', function(event){ 
         
        loadingBar.velocity({ 
            scaleY: scaleMax //this is the scaleY value to cover the entire window height (100% loaded) 
        }, 400, function(){ 
             
            section.addClass('visible'); 
  
            var url = newSection+'.html'; 
  
            if(url!=window.location){ 
                //add the new page to the window.history 
                window.history.pushState({path: url},'',url); 
            } 
  
            // ... 
        }); 
    }); 
} 

Asynchronous loading of the page is also realized to return to the previous browsing history, you can click on to return to the browser. Go Back can equally shows animate the transition.

Category: Javascript / CSS

Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.
<
  • 0 Comments
  • 0 Articles
9 July 2017 14:21

cshang

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
“This whole collecting of these handbags, returning of Cheap Longchamp these handbags — it became a substitute for human connection, which I think is profoundly sad,” Ginsberg said in court. Smatsorabudh, who grew up in michael kors outlet uk Thailand, Ginsberg said, was physically and emotionally abused by her parents, who also fought regularly and openly ralph lauren outlet uk cheated on each other. “I think it was brought on by .?.?. extreme bouts of designer replica handbags loneliness and isolation.”

<
  • 0 Comments
  • 0 Articles
24 July 2017 17:52

Marian W. Barber

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
We are a custom paper writing service aimed at helping students with their projects. The company provides professional academic writing solutions on a broad range of topics do visit us on https://www.dailykos.com/stories/2017/6/29/1676483/how-a-well-written-research-p
aper-differentiate-in-a-grade-and-failure

<
  • 0 Comments
  • 0 Articles
17 August 2017 03:12

essay writing

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Gangaur Realtech is a professionally managed organisation specializing in real estate services where integrated services are provided by professionals to its clients seeking increased value by owning, occupying or investing in real estate. essay writing

<
  • 0 Comments
  • 0 Articles
8 September 2017 10:09

ali

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
On that website page, you'll see your description, why not read through this. Cauliflower Benefits

Interestingly you write, I will address you'll find exciting and interesting things on similar topics. Oranges Health Benefits

<
  • 0 Comments
  • 0 Articles
17 October 2017 01:46

21 Questions

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
21 Questions A debt of gratitude is in order for giving late reports with respect to the worry, I anticipate read more.

<
  • 0 Comments
  • 0 Articles
23 October 2017 19:34

online visiting card maker

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
online visiting card maker I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.

<
  • 0 Comments
  • 0 Articles
26 October 2017 23:57

Katyciara

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Later on, I need to Write an Essay For Me have the capacity to keep up sites for various organizations. I'm talking an HTML coding class and likely in the mid-year, Dreamweaver. What do all of you think?

<
  • 0 Comments
  • 0 Articles
2 December 2017 17:18

Tony

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
This is quite interesting. Loved the way you have explained this article. iPhone 9

<
  • 0 Comments
  • 0 Articles
10 December 2017 22:49

Jhonsan Ravi

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Very good post about the html structure. I have little bit knowledge about the html structure but this post enhance my knowledge. Thanks. Now high demand of E Liquid Packaging boxes

<
  • 0 Comments
  • 0 Articles
2 January 2018 20:55

Roshan

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Zenmate For ApkThanks your post it really so helpful......

<
  • 0 Comments
  • 0 Articles
2 January 2018 21:06

Crow173

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
<
  • 0 Comments
  • 0 Articles
2 January 2018 21:07

Preet

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Idm Crack 2018Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog.

<
  • 0 Comments
  • 0 Articles
2 January 2018 21:08

Happy

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Download The Sims 3 TorrentI should say thank you very much for this thought. It gives me more knowledge on this issue.

<
  • 0 Comments
  • 0 Articles
2 January 2018 21:09

Jugnu

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Malwarebytes PremiumThis is very much a work in progress whenever I find out about one who is more beautiful than any of these I will add her and kick out number ten Thanks for sharing the informative post.

<
  • 0 Comments
  • 0 Articles
2 January 2018 21:10

Ayushman

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Microsoft Toolkit DownloadExcellent and nice article. when user want to get important information then visit our site.

<
  • 0 Comments
  • 0 Articles
11 January 2018 19:09

Gastdd

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
U-Boat montres sont célèbres pour leur grande taille, faite avec beaucoup de métal, ont des conceptions fra?ches,replique rolex et vous faire sentir bien être autour d’eux. Dans le même temps, ils ne sont pas très pratique, replique omega ne l’ont toujours pas ce qu’ils regardent comme ils le devraient dans leurs hottes, et ne sont pas les machines les plus confortables à utiliser sur une base quotidienne.replique breitling l’amour du public et de fortes ventes ont permis d’améliorer la qualité de la marque et une série de replique montre dessins si souvent copié, ils sont rapidement devenus beaucoup préférée amant de montre et symbole de statut social dans certains milieux.

Information
Comment on the news site is possible only within (days) days from the date of publication.