【问题标题】:Making the "hook" "pull to refresh" code work使“挂钩”“拉动刷新”代码工作
【发布时间】:2014-03-24 11:49:14
【问题描述】:

我已经输入了应该在网站被拉出后刷新网站但它不起作用的代码。我在这里得到了代码:http://usehook.com/ 这是我试图让它工作的网站:http://hushmagazine.ca/

我有:

<link href="<?php echo get_template_directory_uri(); ?>/js/hook/hook.css?v=1" rel="stylesheet">

在顶部,我放了:

<div class="hook" id="hook"><div class="hook-loader"><div class="hook-spinner"></div></div></div>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/hook/mousewheel.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/hook/hook.min.js"></script>

想法? 谢谢!

【问题讨论】:

  • 你能给我们看看代码吗?您正在拨打的不同电话以及您的 html?
  • 只是添加了代码,大部分是我从网站上的示例中获取的。
  • 你在打电话给$('#yourID').hook();吗?
  • 我没有。我刚刚在正文中添加了 。 Jquery 不是我的强项,所以我只是从网站上的示例中粘贴了这个。
  • 我根据您的输入添加了一个答案。让我知道这是否适合您。

标签: javascript jquery mobile refresh


【解决方案1】:

你需要添加:

<script>
    $( document ).ready(function() {
        $('#hook').hook(); //Where hook is the id of the parent div
    });
</script> 

在以下标签之间的头部:&lt;head&gt;&lt;/head&gt;

【讨论】:

  • 感谢工作!至少在我的网络浏览器中。但由于某种原因无法在 iPhone 上运行
  • 很遗憾,该插件不兼容移动设备!对不起!
  • 啊,真的,这就是我真正想要实现这整件事的原因:) 这样它就可以在手机上刷新。
  • 哈,太糟糕了,对不起!如果我的回答对您的问题有所帮助,您介意接受吗? Accepting Answers: How does it work?
  • 完成了,我想知道在这方面我能做些什么,因为我仍然没有足够的权限来评价答案。再次感谢。
猜你喜欢
  • 2016-08-06
  • 1970-01-01
  • 2020-01-08
  • 1970-01-01
  • 1970-01-01
  • 2022-11-22
  • 1970-01-01
  • 2018-07-19
  • 1970-01-01
相关资源
最近更新 更多