From b47e7dae9000379d2ecaddc2c5f943faaace6554 Mon Sep 17 00:00:00 2001 From: Bohung Date: Wed, 16 Jun 2021 15:46:00 +0800 Subject: [PATCH] Add light box. --- assets/javascripts/app.js | 6 +++ assets/stylesheets/template/template.scss | 60 ++++++++++++++++++++++- home/index.html.erb | 9 +++- 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 15c244c..4d5b4b4 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -301,6 +301,12 @@ $('.navbar-toggle').click(function(){ $('.navbar-expand-lg').toggleClass('width-controler') }) + if( $('div[data-pp="1000"]').text() !== ''){ + $('.black-screen').addClass('active'); + } + $('.close-btn').click(function() { + $('.black-screen').removeClass('active'); + }) }); }(jQuery, window)); diff --git a/assets/stylesheets/template/template.scss b/assets/stylesheets/template/template.scss index 219a213..86ff496 100644 --- a/assets/stylesheets/template/template.scss +++ b/assets/stylesheets/template/template.scss @@ -19,7 +19,65 @@ // Widget @import "widget/breadcrumb"; @import "widget/sitemenu"; - +.black-screen{ + position: fixed; + width: 100%; + height: 100%; + opacity: 0; + top: -20000px; + background: rgba(0,0,0,.7); + z-index: 1000; + left: 0; + transition:opacity .3s ,top 0s .3s; + &.active{ + opacity: 1; + top:0; + transition:opacity .3s; + .content{ + transform:translate(-50%,-50%); + opacity: 1; + top:50%; + left: 50%; + // box-shadow: #dcabff 0px 0px 150px; + transition:opacity 1s .8s,top .5s .7s ; + } + } + .content{ + background: #fff; + color:#666; + font-family: '微軟正黑體','sans-serif'; + position: absolute; + opacity: 0; + left:-20000px; + top:60%; + transform:translate(-50%,-50%); + transform-origin:center; + width: 90%; + font-weight: bold; + transition:opacity .5s ,top .5s, left 0s .5s; + padding: 2px; + @media (min-width: 768px){ + width: 40%; + padding: 30px; + } + @media (max-width: 767px){ + padding: 30px 10px; + } + .close-btn{ + position: absolute; + right: 0; + top:0; + padding: 5px 10px; + background: $theme-color-main; + color:#fff; + font-size: 18px; + transition:.3s; + &:hover{ + background: $theme-color-second; + } + } + } +} .nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover { background-color: #3d742e; } diff --git a/home/index.html.erb b/home/index.html.erb index b58a5e7..31943f6 100644 --- a/home/index.html.erb +++ b/home/index.html.erb @@ -23,7 +23,14 @@ - +
+
+
+ + + +
+
<%= render_footer %> \ No newline at end of file