1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function slideshowdata( $tagdir = 'top' ) { if ( $dh = opendir( $tagdir )) { for ( $i = 0; $file = readdir( $dh ); ) { if (preg_match ( '/.jpg$/' , $file )) { $images [ $i ++] = $file ; } } srand ((float)microtime() * 1000000); shuffle ( $images ); $cnt = $i ; for ( $i = 0; $i < $cnt ; $i ++) { if ( $i ) print ", " ; print "\"{$images[$i]}\"" ; } closedir ( $dh ); } else { print "directory open error\n" ; } } |
html内
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | < link rel = "stylesheet" type = "text/css" href = "/css/slideshow.css" media = "screen" /> < script type = "text/javascript" src = "/bin/js/mootools.js" ></ script > < script type = "text/javascript" src = "/bin/js/slideshow.js" ></ script > < script type = "text/javascript" src = "/bin/js/slideshow.kenburns.js" ></ script > < script type = "text/javascript" > // <![CDATA[ window.addEvent('domready', function(){ // Load your images here var data = [ <?php slideshowdata('img/top'); ?> ]; var options = { random: true, delay: 10000, duration: 4000, width: 480, height: 120, hu: 'img/top/' } // Initialize the Slideshow instance var myShow = new Slideshow.KenBurns('show', data, options); }); //]]> </ script > |
0 件のコメント:
コメントを投稿