【问题标题】:jQuery inside the HighSlide iframe doesn't workHighSlide iframe 中的 jQuery 不起作用
【发布时间】:2014-04-20 18:06:25
【问题描述】:

简单的 jQuery 不起作用HighSlide iFrame 弹出窗口中......

好的...这正是我所拥有的:

<html>
<head>
     <title>test</title>
     <link rel="stylesheet" type="text/css" href="http://cdn.example.com/plugins/highslide/highslide.css" />
    <!--[if lt IE 7]>
        <link rel="stylesheet" type="text/css" href="http://cdn.example.com/plugins/highslide/highslide-ie6.css" />
    <![endif]-->
    <script async src='//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script>
</head>
<body>
     <a href='update.php' onclick="return hs.htmlExpand(this, { objectType: 'iframe', allowWidthReduction: true } )">update</a>

      <script type="text/javascript" src="http://cdn.example.com/plugins/highslide/highslide-full.js"></script>
    <script type="text/javascript" src="http://cdn.example.com/plugins/highslide/highslide.config.js" charset="utf-8"></script>
</body>
</html>

这里是update.php

的代码
<?php
  echo "<head>";
   echo "<script async src='//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script>";
  echo "</head>";
  echo "<body>";
     ?>
<script>
$(document).ready( function(){
    $('#isMain').click( function(){
       if(this.checked){
          $('#subCats').hide();
       }else{
          $('#subCats').show();
       }
    });
});
</script>
     <?php
     echo "<form action='' method='post' role='form'>";
          echo "<input type='checkbox' name='isMain' id='isMain'> Is Main Category?<br>";
          echo "<select name='subCats' id='subCats'>";
               echo "<option value='noway'>--SELECT--</option>";
               echo "<option value='1'>Games</option>";
               echo "<option value='2'>Music</option>";
          echo "</select>";
     echo "</form>";
  echo "</body>";
?>

但是 jQuery Hide Show 有时可以正常工作,有时不能正常工作...这里到底有什么问题???

【问题讨论】:

  • 您在控制台中收到任何错误吗?你有现场演示吗?

标签: javascript php jquery iframe highslide


【解决方案1】:

jQuery(或任何其他 JavaScript)在使用 Highslide iframe objectType popup - objectType: 'iframe' 打开的页面中工作 - 因为 iframe 弹出窗口完全按照您的编码打开链接页面。

使用您的代码进行演示:http://jsfiddle.net/roadrash/rX4Bc/
iframe 弹窗中使用的页面:http://jsfiddle.net/roadrash/UWq3c/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-07
    • 1970-01-01
    • 2013-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-12
    • 1970-01-01
    相关资源
    最近更新 更多