我想要jquery timeago只显示我在几天的时间!我的意思是,当通过30天时,它会显示我31,32,32天而不是1个月。感谢您的pront答案。Jquery Time Ago only days in
回答
一个解决方案是修改插件以获得您描述的行为。考虑行jquery.timeago.js 83:
days < 30 && substitute($l.days, Math.round(days)) ||
举个例子,如果你改变30
到40
,像这样:
days < 40 && substitute($l.days, Math.round(days)) ||
插件将仍显示 “X天前”直到39天前。
如果要禁用单位比“天”更大的干脆,你可以只取出那部分words
分配中,像这样:
var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
seconds < 90 && substitute($l.minute, 1) ||
minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
minutes < 90 && substitute($l.hour, 1) ||
hours < 24 && substitute($l.hours, Math.round(hours)) ||
hours < 42 && substitute($l.day, 1) ||
substitute($l.days, Math.round(days));
hello andrewap! thax为您的答案!它真的帮助我。 – morrisonrox
@morrisonrox你非常欢迎!请考虑通过点击巨大的绿色复选标记来接受我的答案。 – Andrew
其已完成。还有thanx。 – morrisonrox
- 1. Javascript Epoch Time In Days
- 2. jQuery Time Ago with Twitter Plugin
- 3. “Time ago”from MySQL timestamp
- 4. jQuery .attr()undefined only in Chrome
- 5. Delta Indexing Only Only in Console
- 6. display:table-cell only not in IE11 only
- 7. JTextField time in HH:mm:ss
- 8. Ant-Pathelement with wildcard only only in Javac forked mode
- 9. Jquery Datepicker Days
- 10. WatchPosition Time Out In Geolocation
- 11. Just-In-Time Asset Packager
- 12. Ruby on Rails Time In/Time Out Records
- 13. Actioscript Error#2032 only in IE
- 14. Rails 3 - 给定日期的助手是否会返回“Today”,“Yesterday”或“x days ago”?
- 15. 如何使用Time in Rails?
- 16. JavaScript Just In Time编译
- 17. jquery safari opacity only
- 18. JQuery Mobile Styles Only
- 19. Parse“X years and Y weeks ago”like Ruby in Ruby
- 20. Windows窗体控件是否可以拥有Design Time-only属性?
- 21. Gnuplot group by days
- 22. Core Graphics drawing only only
- 23. Matplotlib xticks as days
- 24. Java array days
- 25. SQL:Group by“business days”
- 26. NSArray with week days
- 27. jquery mousewheel event only working on Chrome
- 28. Icon only back button jQuery Mobile
- 29. JQuery Mobile Pinch Zoom Image Only
- 30. Toggle menu onclick,close by menu link - but only in mobile view
哪个插件?你必须更具体。 – Blender
对不起,我的意思是拔插!我的意思是jquery timeago,你可以在这里找到http://timeago.yarp.com/ – morrisonrox