annotate slide/js/jquery.slideshow.transition.js @ 67:a63c2d9d7db9

fix slide
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Wed, 18 Feb 2015 08:29:48 +0900
parents 8057614d5b77
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
58
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 function transition( $from, $to ) {
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 $from.hide();
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 $to.show();
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 }
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 function transitionSlideUpSlideDown( $from, $to ) {
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 $from.slideUp( 500, function() { $to.slideDown( 1000 ); } );
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 }
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 function transitionFadeOutFadeIn( $from, $to ) {
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 $from.fadeOut( 500 );
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 $to.fadeIn( 500 );
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 }
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 /***********************
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 * sample custom transition using scrollUp effect
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 * inspired by Karl Swedberg's Scroll Up Headline Reader jQuery Tutorial[1]
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 * [1] http://docs.jquery.com/Tutorials:Scroll_Up_Headline_Reader
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 */
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 function transitionScrollUp( $from, $to ) {
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 var cheight = $from.outerHeight();
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 // hide scrollbar during animation
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 $( 'body' ).css( 'overflow-y', 'hidden' );
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 $to.css( 'top', cheight+'px' );
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 $to.show();
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 $from.animate( {top: -cheight}, 'slow' );
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 $to.animate( {top: 0}, 'slow', function() {
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 $from.hide().css( 'top', '0px');
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 // restore possible scrollbar
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 $( 'body' ).css( 'overflow-y', 'auto' );
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 });
8057614d5b77 add slide
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 }