Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!doctype html>
<html ⚡>
<head>
  <meta charset="utf-8">
  <title>amp-lightbox</title>
  <script async src="https://cdn.ampproject.org/v0.js"></script>
  <!-- ## Setup -->
  <!-- Import the amp-lightbox component in the header -->
  <script async custom-element="amp-lightbox" src="https://cdn.ampproject.org/v0/amp-lightbox-0.1.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>  
  <link rel="canonical" href="https://ampbyexample.com/components/amp-lightbox/">
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
  <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
  <style amp-custom>
   .lightbox {
      background: rgba(0,0,0,0.8);
      width: 100%;
      height: 100%;
      position: absolute;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
    }
    .lightbox h1 {
      color: white;
    }

/*搜尋內容*/
.search-content{
position: relative;  
max-width: 300px;
}
.search-title{
}
.search-content h4{
font-size: 20px;
margin-top: 0;

}
/*搜尋關閉按鈕*/
.search-close{
position: absolute;
right: 0;
background: transparent;
border: 0;
color: #fff;
font-size: 25px;
text-align: center;
width: 40px;
height: 40px;
}
.ampstart-btn{
background-color: rgba(0,0,0,0.3);
padding: 2px 10px;
margin-top: 5px;
margin-bottom: 5px;
background-image: none;
border: 1px solid #fff;
border-radius: 4px;  
color: #fff;
font-size:1rem; 
}

  </style>
</head>
<body>
  <!-- 開啟視窗1-點擊後關閉視窗 -->
  <amp-lightbox id="my-lightbox" layout="nodisplay">
    <div class="lightbox" on="tap:my-lightbox.close" role="button" tabindex="0">
      <h1>Hello World!</h1>
    </div>
  </amp-lightbox>
 <!-- 開啟視窗2-內有搜尋欄位 -->
 <amp-lightbox id="search-lightbox"
  layout="nodisplay">
  <div class="lightbox"
    tabindex="0">
    <div class="search-content">
    <div class="search-title"> <button on="tap:search-lightbox.close" class="search-close">X</i></button>
    <h4 class="modal-title text-center">搜尋</h4></div>
         <form method="GET"
  class="p2"
  action="/index.php"
  target="_top">
  <div id="search" class="ampstart-input inline-block relative mb3">
    <input type="hidden" name="module" value="product"><input type="hidden" name="mn" value=""><input type="hidden" name="f" value="search">       
    <input name="k" type="text" class="search_textfield" value="" /> 
   <input name="button" type="submit" class="search_bt" id="button" value="搜尋" />
     </div>
</form>
</div>
  </div>

</amp-lightbox>
  
  <!-- 按鈕1 -->
  <button class="ampstart-btn" on="tap:my-lightbox" role="button" tabindex="0">
    開啟文字視窗
  </button>
 <!-- 按鈕2 -->
  <button class="ampstart-btn" on="tap:search-lightbox" role="button" tabindex="0">
    搜尋視窗
  </button>
 

</body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console