Git Product home page Git Product logo

transition.js's Introduction

Transition.js

This repository is just a wrapper around the code provided for Codrops article on Page Transitions.

Features

  • Next page transition.
  • Previous page transition.
  • Go to a particular page.
  • Add custom animation.
  • Add a list of animation to be played randomly.

Install

####Install via Bower bower install transition.js

Getting Started

###Page Anatomy

  • .pt-wrapper - Add this class to the wrapper div with all the pages and buttons.

  • .pt-trigger - Add this class to the elements to trigger the animation on click.

  • .pt-page - Add this class to all the individual pages.

  • data-animation - This attribute is added to .pt-trigger element with values between 1 to 67. If you need random animation then the values should be separated by -

data-animation="57" it does the 57th animation.

data-animation="50-51-52-53-54" it does a random animation from the list.

  • data-goto - This attribute is added to .pt-trigger element, with values -1 or -2 or any valid page number starting from 1 inside the .pt-wrapper.

data-goto="-1" trigger next page.

data-goto="-2" trigger previous page.

data-goto="2" trigger to go to page 2.

####Sample in action

Adding the transition.js

<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/transition.js"></script>

Adding the HTML

<div class="pt-wrapper">
    <div class="pt-trigger-container">
        <button class="pt-trigger" data-animation="1" data-goto="-1">Go to next page</button>
        <button class="pt-trigger" data-animation="2" data-goto="-2">Go to previous page</button>
        <button class="pt-trigger" data-animation="58" data-goto="1">Go to page 1</button>
        <button class="pt-trigger" data-animation="51-52-53-54-55" data-goto="2">Go to page 2</button>
    </div>

    <!--All Pages-->

    <div class="pt-page pt-page-1">
        <h1><strong>Page 1</strong></h1>
    </div>
    <div class="pt-page pt-page-2">
        <h1><strong>Page 2</strong></h1>
    </div>
</div>

##Down the line

  • Add single page highlighting all the available animation.
  • Add range for random animation.
    something like data-animation="1:10" will make random animation from 1-10.
  • More samples.

###Working with Scroll Navigation and Arrow Key Navigation

Download latest jquery.mousewheel for mouse scroll

<script type="text/javascript">
    $(document).ready(function (){
        // Mouse Scroll
        $('body').mousewheel(function(event, delta) {
            if (delta < 0 ){
                 $("#nextpage").trigger("click");
            }
            else if (delta > 0){
                 $("#prevpage").trigger("click");
            }
         });
        // Arrow Keys
        $("body").keydown(function(e) {
           if(e.keyCode == 37) { // left
                $("#prevpage").trigger("click");
           }
           else if(e.keyCode == 39) { // right
                $("#nextpage").trigger("click");
           }
      });
    });
</script>

Contributing

  1. Fork it.
  2. Create a branch. (git checkout -b my_transition)
  3. Commit your changes. (git commit -am "Added Feature")
  4. Push to the branch. (git push origin my_transition)
  5. Open a Pull Request.
  6. Enjoy a refreshment and wait.

License

All the CSS animations in animation.css were written by Codrops and therefore fall under their license. All other source code is released under the MIT License.

transition.js's People

Contributors

icodebuster avatar dandv avatar

Stargazers

Ramakrishna Kasuba avatar  avatar  avatar TheKangarooFactory avatar Alvin Kwon avatar  avatar  avatar Julien Carré avatar Blaž Weindorfer avatar  avatar  avatar Mursivic avatar 布尔 avatar  avatar  avatar Daniel Lewandowski avatar Peter J avatar Josh Tucholski avatar David Mateo avatar Vilav B. avatar Devendra Singh avatar Shefik avatar Sergey Yarkevich avatar  avatar Vít Rozsíval avatar  avatar YinYu avatar Kiran Sakharamsingh Pardeshi avatar amir moghadam avatar Kyle avatar Paul Barker avatar Roy Zuo avatar  avatar Stefan Smiljkovic avatar Tyson Phalp avatar Iggy Pritzker avatar wupeng avatar Varun U avatar M avatar Raymond Perez avatar ʞↃ∀ɾ avatar Mark Sottek avatar  avatar Joseph Rex avatar Angus H. avatar PANKAJ KUMAR  avatar  avatar  avatar Zoouya avatar Kenneth avatar  avatar James Agwa avatar Vlad Moyseenko avatar Diana Enriquez avatar Nick Adams avatar Rupesh Kumar avatar  avatar xx avatar Tim Moreton Jr avatar Kernel Jackson avatar Washaweb avatar Bryce York avatar Kenneth P. Barquero avatar Tina Billinger avatar dc avatar Axel Chanfrault avatar Leonardo Baraldi avatar  avatar  avatar Fabricio Almeida Araujo avatar Xavier Artot avatar Tomasz Olędzki avatar Jose Varghese avatar Gaurav avatar  avatar  avatar José Pablo Flores García avatar Ben avatar Malachi Simonyan avatar  avatar Alexandra Spalato avatar Borko Savić avatar Sahil Popli avatar Steve Hagins avatar hzp avatar Mike Joyce avatar Ivan Jovanovic avatar Dimitar Kolev-Dick avatar Nicholas avatar Leandro Araújo avatar Jonathan Barratt avatar  avatar Stuart Caney avatar Matheus Czizeweski avatar Jelena Smiljkovic avatar Nik Lanús avatar Gaus Surahman avatar  avatar Mike Yakymenko avatar roybattyy avatar

Watchers

James Cloos avatar Hardkiffeur avatar  avatar  avatar  avatar Sandeep Rana avatar Peter J avatar Gaurav avatar Richard Taimalie avatar Alex Tjokro avatar Mark Sottek avatar  avatar  avatar  avatar  avatar  avatar

transition.js's Issues

Dynamic navigation

Hi, the following doesn't work for me:
<button class="pt-trigger" data-animation="58" data-goto="4">Go to page 4</button>

I'm trying to go to a specific page

Thanks

Scroll and infinty

Hi, i have 2 problems.

  1. 3 slides. 1st is current, then i do one touch on Macbook, or android device, slides scrolls automaticly from 1 to 2 and to 3! Almost in one moment.

  2. And if i scroll to top, from 1st slide go to 3, reverse.

I need fix it.

My code:

$(document).ready(function() {
    $('body').mousewheel(function(event, delta) {
        if (delta < 0 ) {
            $("#nextpage").trigger("click");
        }
        else if (delta > 0) {
            $("#prevpage").trigger("click");
        }
        // e.stopPropagation();
        // e.preventDefault();
    });

    $("body").keydown(function(e) {
        if(e.keyCode == 37) { // left
            $("#prevpage").trigger("click");
        }
        else if(e.keyCode == 39) { // right
            $("#nextpage").trigger("click");
        }
    });
});

Any help?

isanimating doesnt reset

When the animation is done i cant click on a seccond menu item.

after some debugging i find out thats this: $pageWrapper.data('isAnimating', false); is not called after the animation..

Exclude Pages from the rotation

I have a site with multiple pages in the rotation, and three of the pages at the end of the rotation are accessable from buttons on the fourth final page. But, the spec for the job requires the fourth page to be the past accessable from the 'next,prev' buttons.

TO explain:

Page 1 - > Page 2 -> Page 3 -> Page 4 -> Page 5 -> Page 6 -> Page 7 -> Page 1

but Page 8, Page 9 and Page 10 are sub-branched from page 7, and shouldn't be in the main loop.

remove page from array

Ahoj,

first, good job. i like and use your repo.

now the question, title tells it.
it is posible to remove one specific page i.e. pt-page-1 out of the next/prev page array?
in my project i have a 'landing' page with a button (data-goto="2") for navigating to the pt-page2
also i have implemented 2 invisible buttons and script funktions for key, mousewheel and swip scrolling:

a href="#" id="pageleft" class="pt-trigger" data-animation="5" data-goto="-2"
a href="#" id="pageright" class="pt-trigger" data-animation="6" data-goto="-1"

//FUNCTIONS TO NAVIGATE BETWEEN PAGES
//WITH LEFT AND RIGHT ARROW KEY
jQuery(function($) {
$("body").keydown(function(e) {
if(e.keyCode == 37) { // left
$("#pageleft").trigger("click");
}
else if(e.keyCode == 39) { // right
$("#pageright").trigger("click");
}
});
});

i want to take out pt-page-1 to use "data-goto -2 and -1" to scroll only through "page-2 to page-7"

page-1
|
v
page-2 <-> page-3 <-> page-4 <-> page-5 <-> page-6 <-> page-7 <-> page-2 <-> page-3 ...

http://inwork.maverik.de/

More of a feature than issue - Random page

I am using this demo and it's great!
Is there a feature which will allow you to link to a set of random pages, I have tried the same format as random animation:

<button class="pt-trigger" data-animation="4" data-goto="6-7-10-11-12-13-16-17-18-19">RANDOMISE</button>

Any help will be appreciated!

dato-goto is still invalid, any ideas?

          <li>
            <a class="pt-trigger" href="#kontakt" data-animation="58" data-goto="5">Kontakt</a>
          </li>
        `</ul>
        <section class="pt-page pt-page-5" data-id="kontakt">
          <div class="section-title-block">
            <h2 class="section-title">Kontakt</h2>
            <h5 class="section-description">Masz pytanie?</h5>
          </div>``

Not playing nice with Angular.

<div class="pt-trigger" data-animation="1" data-goto="{{ category.id }}">

I am trying to create different links to different pages based on the ID value of a number of categories I have. This number shows anywhere outside of this div element without any issues. How does Transition.js interpret what's in the goto field?

.pt-trigger only inside .pt-wrapper?

Hi! I think your work is amazing! Thanks! But I have an issue: it's very problematic to use the triggers only when they are inside the wrapper. I made some changes and they kind work but I guess you might have something better in mind. Think about a very flexible structure where the triggers might be outsite de wrapper. What do you think?

Links instead buttons

Hello, this is more like question not an issue but I could not find where I can ask.
It is possible to use data-animation on a link instead of button?

Calling manually

Hi!
I'm trying to call the animation when the document is loaded, but I don't understand why I can't do it.

I'm using: PageTransitions.Animate($('a.contact')); and a.contact has the correct data-animation and data-goto attr.

How can I do it ?

Thanks in advance!

Programmatic Transition?

Is it possible to have the page transition on the click of a button? Or controlled by Javascript?

Have controls within each page

Hey, I love the extension and simplification of the Codrops page transitions. I just have one quick question. How do I use a button within a page? I have two separate pages that I was to switch between, but when I remove a button from .pt-trigger-container it doesn't work.

Thanks in advance!

Iframe problem

Hi Jobin,
Thanks for your excellent work !
I was fighting with codrops code to go to specific page until I've found your plugin!

Everything is ok however i've a problem... In my website, i've put 5 youtube videos (iframe), and in webkit they remain in background when I change page.
I do not understand why because in firefox there is no problem.
I tried everything, would you kindly tell me what's wrong?
I will send you the url of demo if you want to take a look ...

Thank you again!

pages wrapper

I want to wrap the pages with a wrapper but the script doesn't work anymore

capture

any idea ?

visibility: hidden & overflow: hidden

with .pt-page set to visibility: hidden & overflow: hidden
I can't scroll any page - how can I solve this without showing any of the other "pages"?

jQuery dependance

In general I try to stay away from jQuery - is there a way to have transition.js not depend on jQuery? Or at least extract the parts of jQuery that it needs?

Issues with transitions 54-57

Excellent, but original code on codrops works fine for me with all transitions whereas with yours transitions 54-57, and only those, cause the trigger buttons to fade out and then back in. I've searched and cannot see any significant changes that might cause this. I'm on OSX and it is the same in both Firefox and Safari.

Invalid 'data-goto' attribute

Hi , I am using your code to animate web pages , but i get always this error message :
Transition.js : Invalid 'data-goto' attribute configuration.
any idea ?
regards

retaining "navigation history"

Hi,

I'm trying to utilize transition.js and am currently facing the following difficulty:
How could one retain some sort of browser history so when clicking on the browser's back or forward buttons, the user navigates directly to that page?
(I'm apparently a newbie in php and js - hence the question...)
Thanks!

Wordpress Integration

I'm not sure if I'm asking in a right place but I was trying to implement to WordPress but it seems that I had trouble implementing it like the id's for anchor are not read at all.
Any suggestions how to do it or best prctice?

Here is the link to the page I also made some alerts and the first parameter is always null
https://transitions-test-mojpe.c9users.io/

I can provide with more info if necesary

Thank you in advance

IE 9 (and lower) crashes

function resetPage($nextPage, $currentPage) {
console.log('fn resetpage');
$currentPage.attr('class', $currentPage.data('originalClassList'));

i9 says that the last line had an error.
the error that ie9 tells me is in dutch so i try to transulate it right.

dutch: kan de eigenschap attr van een niet-gedefinieerde verwijzing of verwijzing naar een lege waarde niet ophalen

englisch: cant get the propertie attr of a not identified reffer or a reffer to an empty value

Adding address to pages.

I like to know if theres a way to when the push the trigger, the site address change to share pages.

Best regards!

Page Transitions for Multi-Step-Form?

Hi there,

just wanted to let you know, that it seems that you can't use your library to make a page transition through forms to be able to make a Multi-Step-Form.

At least something like this whould be awesome, because you would revolutionize multi-step forms.

    <form action="">
        <div class="pt-wrapper">
            <div class="pt-page pt-page1"></div>
            <div class="pt-page pt-page2"></div>
        </div>
    </form>

Do you think there is any way to handle this with your library?

directlink to a page transition

Hi,
Thanks for your wonderful work with the transition.js.
One questions i've seen and have had many ask. is there a way to link directly to a specfiic page from outside? I.e Using an #anchor tag or so?
Please let me know would really appreciate it.
Thanks

Sao

Not playing nice with Angular.

<div class="pt-trigger" data-animation="1" data-goto="{{ category.id }}">

I am trying to create different links to different pages based on the ID value of a number of categories I have. This number shows anywhere outside of this div element without any issues. How does Transition.js interpret what's in the goto field?

Wordpress integration

I'm not sure if I'm asking in right place but I was trying to implement to wordpress but it seems that I had trouble imlementing it like the id's for anchor are not read at all.
Any suggestions how to do it or best prctice?

Thank you in advance

Some web pages persist.

I am using your code to present web pages. On the pages I've placed iframes. Everything works perfectly with some pages e.g. if I place wikipedia pages into those iframes everything works perfectly, but with others e.g. http://www.bbc.co.uk/news the web page persists and remains visible during later transitions. Somehow the page isn't being completely disposed of.

This can be seen by putting an iframe onto just page4 on your demo and then going to pages one to six. With

<iframe height="100%" width="100%" src="https://en.wikipedia.org/wiki/Existentialism"></iframe>

all is good, but with

<iframe height="100%" width="100%" src="http://www.bbc.co.uk/news"></iframe>

the news page continues to display.

Interestingly if you click on a picture on the wikipedia page then that will also persist.

This seems to particularly affect Safari. However, odd things also happen in Firefox where if you have news.bbc on page4 and wikipedia on all other pages then all works fine except the bbc overides on page1. If you only have the iframe on page 4 and your demo pages for the others the bbc does not overide on page1

Overflow scroll

Hi, this is a great plugin.
I use the mousewheel option to go to a div.
Is there an option to scroll into a div and then go to the other when the content is finish?

Thks

data-animation & data-goto from <li> or <a>?

Looking for advice in getting transition to work from within a

  • or tag. We have tried many variations but keep getting - Transition.js : Invalid 'data-goto' attribute configuration.

    Any help is greatly appreciated.

    Cheers.

  • Scroll navigation

    Hi. First, thank you for the great plugin!

    Can you please put me in direction on how to implement a scrolling navigation. What I would like to do is when the user scrolls down -> go to next page, scroll up -> go to previous page.

    I've found this part of the code:

       // NEXT PAGE
       if (gotoPage == -1) {
              // Incrementing page counter to diplay next page
              if(currentPageIndex < pagesCount - 1) {
                     ++currentPageIndex;
              }
              else {
                     currentPageIndex = 0;
              }
       }
    

    However I don't know where to start. Please help me. Thanks in advance.

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.