【问题标题】:Adding onClick event to a footer in Jquery mobile在 Jquery mobile 中将 onClick 事件添加到页脚
【发布时间】:2017-02-26 01:02:29
【问题描述】:

我正在尝试将事件添加到 jquery 移动页脚。源码如下:

<div data-role="footer" id="footer">
    <h2>footer</h2>
</div>

所以,当我触摸手机上的页脚区域时, 我想显示一个网站链接。

如何做到这一点?我像往常一样在谷歌上搜索,但它没有显示我需要什么。谢谢。

【问题讨论】:

  • 应该在哪里显示链接?
  • 附加点击处理程序?

标签: javascript jquery mobile onclick footer


【解决方案1】:

您只需将点击事件侦听器附加到页脚 div,然后在单击页脚 div 时切换链接显示

<div data-role="footer" id="footer">
    <h2>footer</h2>
    <a href="www.google.com" id="link" style="display:none"> Some Link</a>
</div>

<script>
    $('#footer').click(function(){
        $('#link').show();
    });
</script>

JSFiddle:https://jsfiddle.net/na04dhet/

【讨论】:

  • 非常感谢,mplungjan。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-10
  • 2013-07-09
  • 2012-06-16
  • 1970-01-01
  • 2012-06-09
相关资源
最近更新 更多