旅游景点 旅游攻略 生活知识 文化旅游 旅游景区 昆明旅游 桂林旅游 乡村旅游 上海旅游 知识问答

jQuery弹窗大图展示代码

时间:2024-12-01 00:48:55

1、新建html文档。

jQuery弹窗大图展示代码

2、准备好需要用到的图标。

jQuery弹窗大图展示代码

3、书写hmtl代码。<div class="container"> <h1 class="page-title">示例演示 | Galpop Image Gallery Popup</h1> <div class="row"> <div class="col-md-12"> <h2 id="single-head">1、单张图片</h2> <p>Just bind galpop to the anchor link.</p> <div class="gallery-wrapper"> <a class="galpop-single" href="images/gallery/large/apocalypse.jpg"> <img src="images/gallery/thumbs/apocalypse.jpg" class="img-thumbnail" alt="An apocalyptic Earth." /> </a> </div> <h2 id="single-head">2、多张图片</h2> <p>Bind a series of images with the same "data-galpop-group" attribute value.</p> <div class="gallery-wrapper"> <a class="galpop-multiple" data-galpop-group="multiple" href="images/gallery/large/apocalypse.jpg"><img src="images/gallery/thumbs/apocalypse.jpg" class="img-thumbnail" alt="An apocalyptic Earth." /></a>

jQuery弹窗大图展示代码

4、书写css代码。body, html { font-size: 100%; padding: 0; margin: 0; }body { background: #494A5F; color: #D5D6E2; font-weight: 500; font-size: 1.05em; font-family: "Microsoft YaHei", "Segoe UI", "Lucida Grande", Helvetica, Arial, sans-serif; }

jQuery弹窗大图展示代码

5、书写并添加js代码。<script src="js/jquery-1.11.0.min.js" ></script><script src="js/jquery.galpop.min.js"></script><script > $(document).ready(function() { $('.galpop-single').galpop(); $('.galpop-multiple').galpop(); $('.galpop-info').galpop(); var callback = function() { var wrapper = $('#galpop-wrapper'); var info = $('#galpop-info'); var count = wrapper.data('count'); var index = wrapper.data('index'); var current = index + 1; var string = 'Image '+ current +' of '+ count; info.append('<p>'+ string +'</p>').fadeIn(); }; $('.galpop-callback').galpop({ callback: callback }); $('.manual-open').change(function(e) { var image = $(this).val(); if (image) { var settings = {}; $.fn.galpop('openBox',settings,image); } }); $('.manual-open-group').change(function(e) { var v = $(this).val(); var images = [ 'images/gallery/large/apocalypse.jpg', 'images/gallery/large/vintage.jpg', 'images/gallery/large/magicLake.jpg', 'images/gallery/large/underwater.jpg', 'images/gallery/large/goodBoy.jpg', 'images/gallery/large/darkroad.jpg', 'images/gallery/large/roadkill.jpg', 'images/gallery/large/wolfMarine.jpg', 'images/gallery/large/alice.jpg', 'images/gallery/large/reflection.jpg', ]; var settings = {}; $.fn.galpop('openBox',settings,images,v); }); $('.click-open-iframe').galpop({ contentType: 'iframe', }); $('.click-open-ajax').galpop({ contentType: 'AJAX', }); });</script>

jQuery弹窗大图展示代码

6、代码整体结构。

jQuery弹窗大图展示代码

7、查看效果。

jQuery弹窗大图展示代码
© 2026 途途旅游
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com