jquery-fancybox使用

该代码段展示了如何通过引入jQuery库和Fancybox插件创建一个点击后弹出的任务类型选择窗口。页面加载完成后,JavaScript代码会为指定的链接添加点击事件,触发一个固定尺寸、无滚动条的弹出框,显示包含多个任务类型的隐藏内容。
摘要由CSDN通过智能技术生成
<!-- 引入jquery -->
<script type="text/javascript" src="http://hti.cbcie.com/js/jquery-1.7.2.js"></script>
<!-- 引入fancybox的js、css -->
<link rel='stylesheet' type='text/css' href='http://hti.cbcie.com/js/fancybox1.3.4/jquery.fancybox-1.3.4.css' media='screen' />
<script src='http://hti.cbcie.com/js/fancybox1.3.4/jquery.fancybox-1.3.4.js'></script>
 
<!-- 弹窗启动事件 -->
<div><a href="#adddivtest" id="addbtndiv">fancybox弹窗</a></div>
 
<!--弹窗展示内容-->
<div style="display:none;">
    <div id="adddivtest">
 
        <div class="title">任务类型:</div>
        <div class="title">任务类型:</div>
        <div class="title">任务类型:</div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        /*弹出框js*/
        $("a#addbtndiv").fancybox({
            'autoDimensions': false,
            'centerOnScroll': true,
            'scrolling': false,
            'width': 600,
            'height': 350
        });
 
    });
</script>
How to use 1. Setup Include nessesary JS files (FancyBox uses pngFix to fix IE png transparency). --------------------------- /* required */ <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.fancybox.js"></script> /* optional */ <script type="text/javascript" src="js/jquery.pngFix.js"></script> <script type="text/javascript" src="js/jquery.metadata.js"></script> -------------------------------------------- Include FancyBox CSS file. Dont forget to change image paths. -------------------------------------------- <link rel="stylesheet" href="css/fancybox.css" type="text/css" media="screen"> -------------------------------------------- 2. Add your images Add images and wrap them with a link to the zoomed version -------------------------------------------- <a href="image_big.jpg"><img src="image_small.jpg" alt=""/></a> -------------------------------------------- Optional: Use the title attribute if you want to show a caption Optional: Use the rel attribute to group images 3. Use the plugin Sample examples: -------------------------------------------- $(document).ready(function() { $("p#test1 a").fancybox(); $("p#test2 a").fancybox({ 'hideOnContentClick': true }); $("p#test3 a").fancybox({ 'zoomSpeedIn': 0, 'zoomSpeedOut': 0, 'overlayShow': true }); }); ------------------------------------------- Available options hideOnContentClick Hides FancyBox when cliked on zoomed item (false by default) zoomSpeedIn Speed in miliseconds of the zooming-in animation (no animation if 0) zoomSpeedOut Speed in miliseconds of the zooming-out animation (no animation if 0) frameWidth Default width for iframed and inline content frameHeight Default height for iframed and inline content overlayShow If true, shows the overlay (false by default) overlayOpacity Opacity of overlay (from 0 to 1) itemLoadCallback Custom function to get group items (see example on this page source) Comments
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值