一、建立專案repo
echo "# gallery" >> README.md git init git add README.md git commit -m "first commit" git remote add origin git@github.com:webugm/gallery.git git push -u origin master
二、建立Bootstrap4框架
<!DOCTYPE html> <html lang="zh-Hant-TW"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="css/bootstrap.min.css"> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="js/jquery-3.3.1.min.js"></script> <script src="js/popper.min.js"></script> <script src="js/bootstrap.min.js"></script> <title>Bootstrap 離線版</title> </head> <body> </body> </html>
三、建立電子相簿網格
.img-thumbnail
讓圖片有1px邊框的顯示、.img-fluid
設定為響應式四、圖片處理
<div class="container"> <h1 class="my-4 text-center text-lg-left">電子相簿</h1> <div class="row"> <div class="col-lg-3 col-md-4 col-sm-6"> <a href="#" class="d-block mb-4 h-100"> <img class="img-fluid img-thumbnail" src="...." alt=""> </a> </div> </div> </div>
五、電子相簿播放
<!-- lightgallery css --> <link rel="stylesheet" type="text/css" href="lightgallery/css/lightgallery.css"> <!-- lightgallery js --> <script src="lightgallery/js/picturefill.min.js"></script> <script src="lightgallery/js/lightgallery-all.min.js"></script> <script src="lightgallery/js/jquery.mousewheel.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#lightgallery').lightGallery(); }); </script>