博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jquery vticker (vertical news ticker)
阅读量:5290 次
发布时间:2019-06-14

本文共 2271 字,大约阅读时间需要 7 分钟。

jquery vticker (vertical news ticker)

I want to share with you my jquery plugin. I have made this plugin for easy and simple vertical news automatic scrolling. It will calculate height automaticaly, so no styling needed (added an option to set height manually). Just grab it and use it – so simple. Don’t add margin/padding on ul and li tags, try to style elements inside li or around div tag. This is my first jquery plugin, so if you see something wrong please don’t hesitate and say it to me. All criticism is welcome.

Now about the plugin and how to use it.

Html structure looks like:

    • some content
    • some content

Javascript code:

$('.myclass').vTicker();

There are also few options:

speed – speed of scrolling animation (default 700) pause – wait time between scrolling (default 4000) showItems – how many items to show (default 2) animation – animation of sliding. To fade in/fade out use a value ‘fade’ mousePause – stop scrolling on mouse over (default true) height – set vTicker container height. Also disables all items auto height calculation. It is usable to remove space gaps between items. (default 0 – it means off) direction – which direction all items will move. Values are ‘up’ and ‘down’. (default ‘up’)

Example of options usage:

$('.myclass').vTicker({
  speed:500,  pause:3000,  showItems:3,  animation:'fade',  mousePause:false,  height:0,  direction:'up'  });

Using with other plugins

I’ve got a question how to use this plugin with other jquery plugin for Twitter called Tweet! . Tweet! plugin is taking information from twitter and makes a list that can be used with vTicker, but if you try to load simply in $(document).ready({ .. }) it won’t work, because Tweet! plugin loads the list after the document is ready and vTicker won’t have any data to scroll. So you need to use .ajaxStop().

Example

$(function(){
  $('.twitter').tweet({
  ......  }).ajaxStop(function(){
  $('.twitter').vTicker();  });  });

3rd party modifications

In this section you can check modifications done by other users.
  • “I’ve modified the vTicker code so that you can manually scroll the next and previous items and turn pause on if say you are hovering over the next/previous buttons.” – Rich

转载于:https://www.cnblogs.com/happy-Chen/p/3645301.html

你可能感兴趣的文章
[51Nod1089] 最长回文子串 V2(Manacher算法)
查看>>
Asp.Net生命周期系列六
查看>>
php引用 =& 详解
查看>>
Codeforces 914D Bash and a Tough Math Puzzle (ZKW线段树)
查看>>
POJ 3009: Curling 2.0
查看>>
DLNA介绍(包含UPnP,2011/6/20 更新)
查看>>
ANGULARJS5从0开始(2) - 整合bootstrap和font-awesome
查看>>
Android 使用Parcelable序列化对象
查看>>
Python Web框架Django (零)
查看>>
Foxmail出现 错误信息:553 mailbox not found怎么解决
查看>>
spring_远程调用
查看>>
js 中基本数据类型和引用数据类型 ,,,, js中对象和函数的关系
查看>>
登录服务器,首先用到的5个命令
查看>>
多米诺骨牌
查看>>
区间DP 等腰三角形
查看>>
mysql 存储引擎对索引的支持
查看>>
Linq 学习(1) Group & Join--网摘
查看>>
asp.net 调用前台JS调用后台,后台掉前台JS
查看>>
【转】iOS 宏(define)与常量(const)的正确使用-- 不错
查看>>
【转】iOS开发UI篇—iPad和iPhone开发的比较
查看>>