亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從iframe調用父級FancyBox

從iframe調用父級FancyBox

aluckdog 2019-07-13 15:45:59
我有2頁,我的index.html和social.html。我清除了我的索引,只留下了jQuery代碼所需的FancyBox我想要做的是在social.html中擁有圖像,當點擊它時,它會打開FancyBox并顯示它,但是在index.html中,而不是在iframe中。出現的錯誤是:Uncaught TypeError: Property 'showImage' of object [object DOMWindow] is not a function(anonymous function)social.html:103   onclick這是我的index.html:<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script><script type="text/javascript"  src="js/jquery.fancybox-1.3.4.pack.js"></script><link rel="stylesheet" type="text/css" href="css/jquery.fancybox-1.3.4.css" media="screen" /> <script type="text/javascript" src="js/video.js"></script><script type="text/javascript">         function showImage(image) {             $.fancybox('<img src="img/' + image + '" alt="" border="0" />');         };</script></head><body><iframe src="social.html" scrolling="no" border="0" width="579" height="505" allowtransparency="true">         </iframe></body></html>在iframe頁面中: <img src="img/picture1.jpg" alt="" class="thumbs" onclick="parent.showImage('picture1.jpg');"/>PS:兩個頁面都在同一個域上.編輯:visual.js->這是來自FancyBox的,我沒有做這個。jQuery(document).ready(function() {     $(".video").click(function() {         $.fancybox({             'padding'       : 0,             'autoScale'     : false,             'transitionIn'  : 'none',             'transitionOut' : 'none',             'title'         : this.title,             'width'         : 640,             'height'        : 385,             'href'          : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),             'type'          : 'swf',             'swf'           : {             'wmode'             : 'transparent',             'allowfullscreen'   : 'true'             }         });         return false;     });});
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 697 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號