各种弹出层的一个插件,iframe,自定义大小等
XML/HTML Code
- <div id="pronto">
- <article class="project_details lab_details">
- <header class="bordered_bottom page_header"></header>
- <div class="bordered_bottom project_info">
- <div class="row">
- <div class="desktop-8 tablet-6 mobile-3">
- <div class="project_section">
- <pre class=" language-markup"><code class=" language-markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>image.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>boxer<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Caption<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>thumbnail.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Thumbnail<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span></code></pre>
- <h5>Demo</h5>
- <div class="clear_fix">
- <a href="images/nasa-bw-1.jpg" class="boxer boxer_image" title="By NASA on The Commons (Apollo-Soyuz) [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-1.jpg" alt="" style="height: 100px;">
- </a>
- </div>
- <hr>
- <h3>Gallery</h3>
- <p><code class=" language-markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>image_1.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>boxer<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Caption One<span class="token punctuation">"</span></span> <span class="token attr-name">rel</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>gallery<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>thumbnail_1.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Thumbnail One<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>image_2.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>boxer<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Caption Two<span class="token punctuation">"</span></span> <span class="token attr-name">rel</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>gallery<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>thumbnail_2.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Thumbnail Two<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span></code></p>
- <h5>Demo</h5>
- <div class="clear_fix">
- <a href="images/nasa-bw-1.jpg" class="boxer boxer_image" rel="gallery" title="By NASA on The Commons (Apollo-Soyuz) [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-1.jpg" alt="" style="height: 100px;">
- </a>
- <a href="images/nasa-bw-2.jpg" class="boxer boxer_image" rel="gallery" title="By NASA on The Commons (Bumper V-2 Launch) [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-2.jpg" alt="" style="height: 100px;">
- </a>
- <a href="images/nasa-bw-3.jpg" class="boxer boxer_image" rel="gallery" title="By NASA on The Commons [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-3.jpg" alt="" style="height: 100px;">
- </a>
- </div>
- <hr>
- <h3>Fixed Positioning</h3>
- <p><code class=" language-javascript">$<span class="token punctuation">(</span><span class="token string">".boxer"</span><span class="token punctuation">)</span><span class="token punctuation">.</span>boxer<span class="token punctuation">(</span><span class="token punctuation">{</span>
- fixed<span class="token punctuation">:</span> <span class="token boolean">true</span>
- <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></p>
- <h5><a href="images/nasa-bw-1.jpg" class="boxer boxer_image boxer_fixed" rel="gallery_fixed" title="By NASA on The Commons (Apollo-Soyuz) [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-1.jpg" alt="" style="height: 100px;">
- </a>
- <a href="images/nasa-bw-2.jpg" class="boxer boxer_image boxer_fixed" rel="gallery_fixed" title="By NASA on The Commons (Bumper V-2 Launch) [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-2.jpg" alt="" style="height: 100px;">
- </a>
- <a href="images/nasa-bw-3.jpg" class="boxer boxer_image boxer_fixed" rel="gallery_fixed" title="By NASA on The Commons [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-3.jpg" alt="" style="height: 100px;">
- </a></h5>
- <hr>
- <h3>Top Positioning</h3>
- <p><code class=" language-javascript">$<span class="token punctuation">(</span><span class="token string">".boxer"</span><span class="token punctuation">)</span><span class="token punctuation">.</span>boxer<span class="token punctuation">(</span><span class="token punctuation">{</span>
- top<span class="token punctuation">:</span> <span class="token number">50</span>
- <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></p>
- <h5><a href="images/nasa-bw-1.jpg" class="boxer boxer_image boxer_top" rel="gallery_top" title="By NASA on The Commons (Apollo-Soyuz) [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-1.jpg" alt="" style="height: 100px;">
- </a>
- <a href="images/nasa-bw-2.jpg" class="boxer boxer_image boxer_top" rel="gallery_top" title="By NASA on The Commons (Bumper V-2 Launch) [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-2.jpg" alt="" style="height: 100px;">
- </a>
- <a href="images/nasa-bw-3.jpg" class="boxer boxer_image boxer_top" rel="gallery_top" title="By NASA on The Commons [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-3.jpg" alt="" style="height: 100px;">
- </a></h5>
- <hr>
- <h3>In-Line Content</h3>
- <p><code class=" language-markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>#hidden<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>boxer<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Show Content<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>display: none;<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- ...
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span></code></p>
- <h5><a href="http://www.benplum.com/formstone/boxer/#hidden_content" class="boxer button small">Show Hidden Content</a></h5>
- <div id="hidden_content" style="display: none;">
- <div class="inline_content">
- <h2>Some Content!</h2>
- <p>This was hidden on the page and loaded into the new Boxer instance.</p>
- <a href="http://www.benplum.com/formstone/boxer/#" class="button small resize_modal no-pronto" style="margin: 10px;">Resize</a>
- <a href="http://www.benplum.com/formstone/boxer/#" class="button small close_modal no-pronto" style="margin: 10px;">Close</a>
- </div>
- </div>
- <hr>
- <h3>jQuery Objects</h3>
- <p><code class=" language-javascript">$obj <span class="token operator">=</span> $<span class="token punctuation">(</span><span class="token string">"Content!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
- <span class="token comment" spellcheck="true">// OR
- </span>$obj <span class="token operator">=</span> $<span class="token punctuation">(</span><span class="token string">"<div />"</span><span class="token punctuation">)</span><span class="token punctuation">.</span>load<span class="token punctuation">(</span>"http<span class="token punctuation">:</span><span class="token comment" spellcheck="true">//www.url.com/partial-markup/");
- </span>
- $<span class="token punctuation">.</span>boxer<span class="token punctuation">(</span>$obj<span class="token punctuation">)</span><span class="token punctuation">;</span></code></p>
- <h5><a href="http://www.benplum.com/formstone/boxer/#" class="boxer button small object">Show jQuery Object</a></h5>
- <hr>
- <h3>iFrame</h3>
- <p><code class=" language-markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.example.com/<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>boxer<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Example<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span></code></p>
- <h5><a href="http://www.freejs.net/" class="boxer button small" data-scout-event="http://www.freejs.net/">View freejs.net</a></h5>
- <hr>
- <h3>Custom Sizing</h3>
- <p><code class=" language-markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.example.com/<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>boxer<span class="token punctuation">"</span></span> <span class="token attr-name">data-height</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>500<span class="token punctuation">"</span></span> <span class="token attr-name">data-width</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>500<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Example<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span></code></p>
- <h5><a href="http://freejs.net/" class="boxer button small" data-height="500" data-width="500" data-scout-event="ExternalLink, Click, freejs.net/">View freejs.net</a></h5>
- <hr>
- <h3>Custom Caption Formats</h3>
- <p><code class=" language-javascript">$<span class="token punctuation">(</span><span class="token string">".boxer"</span><span class="token punctuation">)</span><span class="token punctuation">.</span>boxer<span class="token punctuation">(</span><span class="token punctuation">{</span>
- formatter<span class="token punctuation">:</span> formatCaptions
- <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
- <span class="token keyword">function</span> formatCaptions<span class="token punctuation">(</span>$target<span class="token punctuation">)</span> <span class="token punctuation">{</span>
- <span class="token keyword">return</span> <span class="token string">'<h3>'</span> <span class="token operator">+</span> $target<span class="token punctuation">.</span>attr<span class="token punctuation">(</span><span class="token string">"title"</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token string">'</h3>'</span><span class="token punctuation">;</span>
- <span class="token punctuation">}</span></code></p>
- <h5><a href="images/nasa-bw-1.jpg" class="boxer boxer_image boxer_format" title="By NASA on The Commons (Apollo-Soyuz) [Public domain], via Wikimedia Commons">
- <img src="images/nasa-bw-1.jpg" alt="" style="height: 100px;">
- </a></h5>
- <hr>
- <h3>Retina Support</h3>
- <p><code class=" language-javascript">$<span class="token punctuation">(</span><span class="token string">".boxer"</span><span class="token punctuation">)</span><span class="token punctuation">.</span>boxer<span class="token punctuation">(</span><span class="token punctuation">{</span>
- retina<span class="token punctuation">:</span> <span class="token boolean">true</span>
- <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></p>
- <pre class=" language-markup"><code class=" language-markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>image-2x.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>boxer<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Caption - Retina<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>thumbnail-2x.jpg<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Thumbnail - Retina<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span></code></pre>
- <h5><a href="images/nasa-bw-retina.jpg" class="boxer boxer_image retina" title="By Apollo 15 astronaut.Bubba73 at en.wikipedia [Public domain], from Wikimedia Commons">
- <img src="images/nasa-bw-retina.jpg" alt="" style="height: 100px;">
- </a></h5>
- <hr>
- </div>
- </div>
- </div>
- </div>
- </article><br>
- </div>
- </div>
- <script type="text/javascript" src="../../js/jquery-1.9.1.min.js"></script>
- <link href="images/jquery.fs.boxer.css" rel="stylesheet" type="text/css" media="all">
- <script src="images/jquery.fs.boxer.js"></script>
- <script>
- $(document).ready(function() {
- $(".boxer").not(".retina, .boxer_fixed, .boxer_top, .boxer_format, .object").boxer();
- $(".boxer.boxer_fixed").boxer({
- fixed: true
- });
- $(".boxer.boxer_top").boxer({
- top: 50
- });
- $(".boxer.retina").boxer({
- retina: true
- });
- $(".boxer.boxer_format").boxer({
- formatter: function($target) {
- return '<h3>' + $target.attr("title") + "</h3>";
- }
- });
- $(".boxer.object").click(function(e) {
- e.preventDefault();
- e.stopPropagation();
- $.boxer( $('<div class="inline_content"><h2>More Content!</h2><p>This was created by jQuery and loaded into the new Boxer instance.</p></div>') );
- });
- $(window).one("pronto.load", function() {
- $(".boxer").boxer("destroy");
- });
- $("body").on("click", ".resize_modal", function() {
- $("#boxer").trigger("resize", [500, 500]);
- return false;
- }).on("click", ".close_modal", function() {
- $("#boxer").trigger("close");
- return false;
- });
- });
- </script>
原文地址:http://www.freejs.net/article_jquerywenzi_176.html