用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - php代码库

css3 灯箱画廊(支持拖拽)

2013-07-10 作者: 免费源代码下载整理举报

[php]代码库

<?php
 
// Hiding notices:
error_reporting(E_ALL^E_NOTICE);
 
?>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>An Awesome CSS3 Lightbox Gallery With jQuery | Tutorialzine demo</title>
 
<link rel="stylesheet" type="text/css" href="demo.css" />
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-darkness/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.2.6.css" />
 
 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.2.6.pack.js"></script>
<script type="text/javascript" src="script.js"></script>
 
</head>
 
<body>
 
<div id="main">
    <p id="orig">View the <a href="http://tutorialzine.com/2009/11/hovering-gallery-css3-jquery/" target="_blank">original tutorial &raquo;</a></p>
    <h1>An Awesome CSS3 Lightbox Gallery</h1>
    <h2>Drag the pics around to share them</h2>
 
    <hr />
 
    <div id="gallery">
     
<?php
 
/* Configuration Start */
 
$thumb_directory = 'img/thumbs';
$orig_directory = 'img/original';
 
$stage_width=600;   // How big is the area the images are scattered on
$stage_height=400;
 
/* Configuration end */
 
$allowed_types=array('jpg','jpeg','gif','png');
$file_parts=array();
$ext='';
$title='';
$i=0;
 
/* Opening the thumbnail directory and looping through all the thumbs: */
 
$dir_handle = @opendir($thumb_directory) or die("There is an error with your image directory!");
 
$i=1;
while ($file = readdir($dir_handle))
{
    /* Skipping the system files: */
    if($file=='.' || $file == '..') continue;
     
    $file_parts = explode('.',$file);
    $ext = strtolower(array_pop($file_parts));
 
    /* Using the file name (withouth the extension) as a image title: */
    $title = implode('.',$file_parts);
    $title = htmlspecialchars($title);
 
    /* If the file extension is allowed: */
    if(in_array($ext,$allowed_types))
    {
        /* Generating random values for the position and rotation: */
        $left=rand(0,$stage_width);
        $top=rand(0,400);
        $rot = rand(-40,40);
         
        if($top>$stage_height-130 && $left > $stage_width-230)
        {
            /* Prevent the images from hiding the drop box */
            $top-=120+130;
            $left-=230;
        }
         
        /* Outputting each image: */
         
        echo '
        <div id="pic-'.($i++).'" class="pic" style="top:'.$top.'px;left:'.$left.'px;background:url('.$thumb_directory.'/'.$file.') no-repeat 50% 50%; -moz-transform:rotate('.$rot.'deg); -webkit-transform:rotate('.$rot.'deg);">
        <a class="fancybox" rel="fncbx" href="'.$orig_directory.'/'.$file.'" target="_blank">'.$title.'</a>
        </div>';
    }
}
 
/* Closing the directory */
closedir($dir_handle);
 
?>
    <div class="drop-box">
    </div>
     
    </div>
     
    <div class="clear"></div>
     
    <div class="container tutorial-info">
    This is a tutorialzine demo. View the <a href="http://tutorialzine.com/2009/11/hovering-gallery-css3-jquery/" target="_blank">original tutorial</a>, or download the <a href="demo.zip">source files</a>.    </div>
</div>
 
<!-- This is later converted to the modal window with the url of the image: -->
 
<div id="modal" title="Share this picture">
    <form action="">
    <fieldset>
        <label for="url">URL of the image</label>
        <input type="text" name="url" id="url" class="text ui-widget-content ui-corner-all" onfocus="this.select()" />
    </fieldset>
    </form>
 
</div>
 
</body>
</html>

[代码运行效果截图]


css3 灯箱画廊(支持拖拽)

[源代码打包下载]




网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...