将timeago与jquery mobile一起使用
有人试过这个吗?我很难让它发挥作用 我尝试使用以下两种方法(一种或另一种)在模板头部初始化它:将timeago与jquery mobile一起使用,jquery,jquery-mobile,timeago,Jquery,Jquery Mobile,Timeago,有人试过这个吗?我很难让它发挥作用 我尝试使用以下两种方法(一种或另一种)在模板头部初始化它: <script> $('div:jqmData(role="page")').live('pagebeforeshow',function(){ jQuery("abbr.timeago").timeago(); }); </script> <script> jQuery(document).ready(function() { jQuery("abbr
<script>
$('div:jqmData(role="page")').live('pagebeforeshow',function(){
jQuery("abbr.timeago").timeago();
});
</script>
<script>
jQuery(document).ready(function() {
jQuery("abbr.timeago").timeago();
});
</script>
$('div:jqmData(role=“page”)).live('pagebeforeshow',function(){
jQuery(“缩写为timeago”).timeago();
});
jQuery(文档).ready(函数(){
jQuery(“缩写为timeago”).timeago();
});
然后在内容部分,我尝试通过以下方式实现它:
2008年7月17日
正如timeago文档所示
虽然我只看到了2008年7月17日,没有动态的时间变化
有人知道如何做到这一点吗?正如您在本例中看到的: HTML:
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
<div data-theme="a" data-role="header">
<h3>
First Page
</h3>
<a href="#second" class="ui-btn-right">Next</a>
</div>
<div data-role="content">
<abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
</body>
</html>
正如您在本例中所看到的,它是有效的: HTML:
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
<div data-theme="a" data-role="header">
<h3>
First Page
</h3>
<a href="#second" class="ui-btn-right">Next</a>
</div>
<div data-role="content">
<abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
</body>
</html>