单击时如何使关闭的手风琴选项卡打开外部 url
How to make a closed accordion tab open an external url when clicked
我在 https://github.com/jellekralt/Responsive-Tabs on this design: http://www.sitesellprosdesign.com/demo.html
使用 JelleKralt 响应式标签
我需要一些选项卡来打开外部 url 并成功地使用了:
<script type="text/javascript">
$('a[href^="#tab-4"]').on('click', function(event) {
window.location.href="http://www.google.com";
});
</script>
However, when the tabs switch to accordion, the redirect does not work.我需要一种方法让手风琴标题在单击时也打开外部 url。
如有任何帮助,我们将不胜感激。我一点也不精通 javascript/jQuery 所以我在这里即兴发挥。
可能是您的点击事件未绑定,因为为新布局(手风琴)重新创建了元素。尝试更可持续的绑定:
$(document).on('click', 'a[href="#tab-4"]', function() {
window.location.href = "http://whosebug.com/";
});
我在 https://github.com/jellekralt/Responsive-Tabs on this design: http://www.sitesellprosdesign.com/demo.html
使用 JelleKralt 响应式标签我需要一些选项卡来打开外部 url 并成功地使用了:
<script type="text/javascript">
$('a[href^="#tab-4"]').on('click', function(event) {
window.location.href="http://www.google.com";
});
</script>
However, when the tabs switch to accordion, the redirect does not work.我需要一种方法让手风琴标题在单击时也打开外部 url。
如有任何帮助,我们将不胜感激。我一点也不精通 javascript/jQuery 所以我在这里即兴发挥。
可能是您的点击事件未绑定,因为为新布局(手风琴)重新创建了元素。尝试更可持续的绑定:
$(document).on('click', 'a[href="#tab-4"]', function() {
window.location.href = "http://whosebug.com/";
});