zoukankan      html  css  js  c++  java
  • colorbox学习笔记iframe内嵌页面调用父页面colorbox

    常常用到iframe内嵌另一个页面,而这个页面里显示图片,当点击这个内嵌页面中的图片,让他在父级页面显示colorbox的效果

    1.首先iframe内页面额代码

    js:
     function colorBox() {
                var url = document.getElementById("bigPic").src;
                window.parent.showBigPic(url);
            }
    html:
    <img id="bigPic" src="<%=BigPic %>" ondblclick="colorBox()" alt="" style="300px;height:200px;" />

    2.外面大页面

    引用: 
    <script type="text/javascript" src="/public/js/jquery-1.4.4.min.js"></script>
        <link href="http://www.cnblogs.com/public/ColorBox/colorbox.css" rel="stylesheet" type="text/css" />
        <script src="http://www.cnblogs.com/public/ColorBox/jquery.colorbox-min.js" type="text/javascript"></script>
    
    js:
    //显示图片
            function showBigPic(url) {
                $.colorbox({ html: "<div><img src='" + url + "'></div>" });
                $('div#cboxLoadedContent').css({ "border-bottom": "none", "background": "transparent" });
            }

    3.大功告成!

             
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    marshaller unmarshaller解析xml和读取xml
    request请求地址
    SAP系统接口方式:
    SAP 后台job
    查找系统锁对象
    动态生成ABAP程序-资料
    BDC程序步骤
    ABAP 创建测试文件
    ALE和IDocs
    ABAP锁,数据库锁
  • 原文地址:https://www.cnblogs.com/wuchao/p/2946145.html
Copyright © 2011-2022 走看看