annotate Slide/s6/js/jquery.slideshow.transition.js @ 32:6da32e2f11c2

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