Easy Ticker是一个jQuery插件,可帮助您在网页上创建一个高度可定制、跨浏览器、SEO友好、灵活且无限的新闻Ticker。
1.在文档中包含最新的jQuery库和jQuery.easy-ticker.js。
<script src="/path/to/cdn/jquery.min.js"></script> <script src="/path/to/dist/jquery.easy-ticker.min.js"></script>
2.包含用于缓解功能的jQuery缓解插件。(可选)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>
3.为你的新闻行情创建html。
<div class="demo"> <ul> <li> <img src="https://www.jqueryscript.net/small/images/jQuery-Plugin-To-Expand-Collapse-Input-Field-Expandable-Input.jpg" alt="Expandable Input" /> <a href="https://www.jqueryscript.net/form/jQuery-Plugin-To-Expand-Collapse-Input-Field-Expandable-Input.html">Expandable Input</a> <p>Expandable Input is a minimal jQuery plugin to smoothly expand the width of a input filed when focused/clicked and collapse it when lose focus.</p> </li> <li class="odd"> <img src="https://www.jqueryscript.net/small/images/Creating-A-Full-Page-Photo-Gallery-with-jQuery-Photor-Plugin.jpg" alt="jQuery Photor Plugin" /> <a href="https://www.jqueryscript.net/gallery/Creating-A-Full-Page-Photo-Gallery-with-jQuery-Photor-Plugin.html">jQuery Photor Plugin</a> <p>Photor is a fast and easy jQuery plugin to create a responsive & touch-friendly full page image gallery with CSS3 transitions and transforms.</p> </li> <li> <img src="https://www.jqueryscript.net/small/images/Windows-8-Style-jQuery-Data-Table-Decorator-Metreaux-Tables.jpg" alt="Metreaux Tables" /> <a href="https://www.jqueryscript.net/table/Windows-8-Style-jQuery-Data-Table-Decorator-Metreaux-Tables.html">Metreaux Tables</a> <p>Metreaux Tables is a jQuery plugin to create nice, clean, themeable, andmodern Windows 8 UI Style data tables with the power of DataTables jQuery javascript library.</p> </li> ... </ul> </div>
4.使用默认设置调用插件。就是这样。
$(function(){ $('.demo').easyTicker(); });
5.所有可能的选项来配置新闻行情。
$('.demo').easyTicker({ // or 'down' direction: 'up', // easing function easing: 'swing', // animation speed speed: 'slow', // animation delay interval: 2000, // height height: 'auto', // the number of visible elements of the list visible: 0, // enables pause on hover mousePause: true, // enables autoplay autoplay: true, // custom controls controls: { up: '', down: '', toggle: '', playText: 'Play', stopText: 'Stop' }, // callbacks callbacks: { before: function(ul, li){ // do something }, after: function(ul, li){ // do something }, finish: function(ul, li){ // do something } } });
版本3.4.0(2022-01-23)
版本3.4.0(2022-01-21)
版本3.3.0(2022-01-03)
第3.2.1版(2020-04-13)
2020-04-13