LoginSignup
1
0

More than 3 years have passed since last update.

【OnsenUI】画面遷移とアニメーションの設定方法

Last updated at Posted at 2020-02-25

画面遷移の方法

main.js

if (page.id === 'page1') {
  page.querySelector('#switch_button').onclick = function() {
    document.querySelector('#myNavigator').pushPage('page2.html',slide);
  };
} else if (page.id === 'page2') {
  page.querySelector('#return_button').onclick = function() {
    document.querySelector('#myNavigator').popPage(slide);
  };
};

画面遷移には、pushPage popPageメソッドを使用します。
引数に、あらかじめ作成したページとアニメーションを指定します。(popPageにはアニメーションのみ)

アニメーションの設定

main.js
const slide = {
  animation: 'slide',onTransitionEnd: function(){}
};

animationには以下の4つが用意されています。

  • slide
  • lift
  • fade
  • none

参考文献

OnsenUIの基礎-OnsenUI

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0