fancybox popup执行选择选项

时间:2017-05-08 21:49:15

标签: javascript jquery html css fancybox

我有一个json文件激发了一系列图像。我有精美的盒子安装,当你点击图像时,会出现一个内联div。在内联div中,我显示图像,并在下拉框中显示选择选项。我的想法是选择一个选项然后转到相应的页面。我可以使用链接,但我希望它使用下拉功能。在精美的盒子窗口中不会执行任何功能。

function fruitselect() {
      var e = document.getElementById("mySelect");
var strUser = e.options[e.selectedIndex].value;
  alert(strUser);
};
<form>
Select your favorite fruit:
<select id="mySelect" onchange="fruitselect()">
  <option value="apple">Apple</option>
  <option value="orange">Orange</option>
  <option value="pineapple">Pineapple</option>
  <option value="banana">Banana</option>
</select>
</form>

有办法做到这一点吗?

1 个答案:

答案 0 :(得分:1)

您的评论很难理解,我认为您的代码没有任何问题:http://codepen.io/anon/pen/pPpVxe?editors=1010

此外,如果导致某些问题,您可以禁用“触摸”功能:

<a data-fancybox data-options='{"src": "#content", "touch": false}' href="javascript:;">
  Open demo
</a>