一、效果图:

tips源码下载:http://files.cnblogs.com/waitingbar/newslist.rar

二、jquery源码:

(function($){$.fn.extend({newsList:function(options){var defaults ={actName:'li',          //显示条数名;maxShowNum:'6',       //最多的显示条数;actNameH:'28',       //一次移动的距离;ulClass:'.ul_news_list',           //被复制层的classcopyUlClass:'.ul_news_list2',     //复制层的classautoTime:'1500',  //自动运行时间;clickGoUpC:'.go_uplist',        //点击向上class; clickDownUpC:'.go_downlist',   //点击向下class; goStart:'go_tart',autoCloss:'flase'    //自动运行开关,当为'flase'时为开,其它则关;} ;options = $.extend(defaults, options);return this.each(function(){var o = options;var counts =1;var linum = $($(this).find(o.actName),$(this)).size();var ul_class = $($(this).find(o.ulClass),$(this));var copy_ul_class = $($(this).find(o.copyUlClass),$(this));var click_go_up_c = $($(this).find(o.clickGoUpC),$(this));var click_go_down_C = $($(this).find(o.clickDownUpC),$(this));var go_start = $($(this).find(o.goStart),$(this));if(linum > o.maxShowNum){$(copy_ul_class).html($(ul_class).html());goStartList();}var thiswrap = $($(ul_class).parent().parent(),$(this));//自动运行函数function auto_function(){if(counts <= linum){$(ul_class).animate({top:'-=' + o.actNameH},o.autoTime);$(copy_ul_class).animate({top:'-=' + o.actNameH},o.autoTime);counts++;}else{$(ul_class).animate({top:0},0);$(copy_ul_class).animate({top:0},0);counts = 1;    }}//点击向上移动时;if(linum > o.maxShowNum){$(click_go_up_c).click(function(){if(counts <= linum){$(ul_class).animate({top:'-=' + o.actNameH},0);$(copy_ul_class).animate({top:'-=' + o.actNameH},0);counts++;}else{$(ul_class).animate({top:0},0);$(copy_ul_class).animate({top:0},0);counts = 1;}});}//点击向下移动时;if(linum > o.maxShowNum){$(click_go_down_C).click(function(){if(counts > 1){counts--;$(ul_class).animate({top:'-'+ counts*o.actNameH},0);$(copy_ul_class).animate({top:'-'+ counts*o.actNameH},0);}else{$(ul_class).animate({top:0},0);$(copy_ul_class).animate({top:0},0);counts = linum+1;}});}//鼠标经过所发生的开始停止;if(linum > o.maxShowNum){$(thiswrap).hover(function(){goStopList();},function(){goStartList();});}function goStartList(){if(o.autoCloss === 'flase'){go_start = setInterval(auto_function,o.autoTime);}}function goStopList(){clearInterval(go_start);}});}});
}(jQuery));

三、HTML:

<script language="javascript">
$(document).ready(function(){
    $("#newslist").newsList();
});
</script>

<div id="newslist">
      <div class="go_upanddown"><span class="go_uplist"><img src="data:images/newslist/goupbtn.gif" /></span><span class="go_downlist"><img src="data:images/newslist/godownbtn.gif" /></span></div>
    <div class="news_list_bar">
       <ul class="ul_news_list">
          <li><a href="#">1、曾参加过唐山、汶川、玉树地震救援的援</a><a href="#">曾参加过唐,又来到了舟曲参加救援</a></li>
          <li><a href="#">2、摩洛哥塞拉,艺术家在一场为流浪儿童为流浪儿童为流浪儿童为流浪儿童募捐的马戏节目中表演</a></li>
          <li><a href="#">3、昆明警方近日县的“洪兴甸县的“洪兴甸县的“洪兴甸县的“洪兴帮”黑恶势力团伙,缴获...</a></li>
          <li><a href="#">4、印度克什知自己的孩子在骚乱中丧生时痛不欲生..</a><a href="#">曾参加过唐曾参加过唐到了舟曲参加救援</a></li>
          <li><a href="#">5、明昆明警方近日捣毁了寻甸县的“洪兴帮”黑恶势力团伙,缴获...</a></li>
          <li><a href="#">6、曾参加过唐曾参加过唐曾参加过唐曾参加过唐</a></li>
          <li><a href="#">7、湖北武汉汉口汉口曾参加过唐曾参加过唐曾参加过唐曾参加过唐观看两江洪峰过</a></li>
          <li><a href="#">8、湖北武汉汉曾参加过唐曾参加过唐曾参加过唐曾参加过唐集在江边观</a></li>
          <li><a href="#">9、湖北武汉汉口汉口龙王庙景区观景平台上,市民聚集在江边观看两江洪峰过汉</a></li>
      </ul>
       <ul class="ul_news_list2"></ul>
  </div>
</div>

四、CSS:

body { font-family:"微软雅黑",Arial,"Lucida Grande", Verdana, Lucida; font-size:12px; }
*{ padding:0; margin:0;}
img { border:0;}
.clear { clear:both;}
a { color:#000; text-decoration:none;}
a:hover { color:#EC6104;  text-decoration:none;}
.undis { display:none;}/*news_list*/
.news_list_bar { position:relative;  width:560px; height:168px; overflow:hidden; background:url(../images/slideshow2/v3_picture6.gif) repeat-y; background-color:#F00;}
.ul_news_list,
.ul_news_list2{ position:relative; list-style:none;}
.ul_news_list li,
.ul_news_list2 li{line-height:28px;  height:28px; width:500px; overflow:hidden; white-space:nowrap;padding:0 20px;}
.ul_news_list li a,
.ul_news_list2 li a{ padding-right:20px;}
.go_upanddown { position:absolute; margin:-20px 0 0 500px;}
.go_upanddown span { padding-right:10px; cursor:pointer;}

转载于:https://www.cnblogs.com/waitingbar/archive/2011/03/04/1970959.html

jquery插件之无缝循环新闻列表相关推荐

  1. jQuery:收集一些基于jQuery框架开发的控件/jquery插件2

    Horizontal accordion: jQuery 基于jQuery开发,非常简单的水平方向折叠控件. 主页:http://letmehaveblog.blogspot.com/2007/10/ ...

  2. 1000个JQuery插件(转载)

    超强1000个jquery极品插件!(转) 花N长时间积累的Jquery插件,希望大家喜欢.大家还有什么新的插件,请留言,我们一并收录. 感谢大家的支持. ++++++++++++++++++++++ ...

  3. 小白的jquery学习之路之04效果新闻向上无缝循环显示

    15该节的原理是通过改变里面的ul的top值实现的 第一种方法,当c=4时,让c=0,我们会发现新闻刷刷的向上走,因此是不行的,没做到无缝循环显示 <html> <head>& ...

  4. jQuery新闻列表滚动(上下滚动、横向滚动、无缝滚动、停顿滚动)

    自己搜的代码,亲测好使,可以根据自己的需要进行样式及js修改 <!doctype html> <html> <head><meta charset=" ...

  5. html列表拖拽排序插件,可对列表自由拖拽排序的jQuery插件

    dragslot.js是一款可以对列表自由拖拽排序的jQuery插件.该插件主要的功能是实现了列表项可以在各个列表中相互拖拽. 对于像todo list, 分配任务列表都可以应用这个效果. 使用方法 ...

  6. 超全超实用的Javascript类库和jQuery插件大全之二:文字处理,表格和列表处理,实用......

    为什么80%的码农都做不了架构师?>>>    日期:2012-10-15  来源:GBin1.com 如果你需要解决一些开发中遇到的技术问题的话,很可能会找到一些相关的javasc ...

  7. 基于JS实现新闻列表无缝向上滚动实例代码

    当新闻较多,并且空前有限的时候,使用滚动是一个不错的选择,本章节就通过代码实例介绍一下如何实现此效果. 代码实例如下: <!DOCTYPE html> <html> <h ...

  8. Lazy Load, 延迟加载图片的 jQuery 插件 - NeoEase

    Lazy Load, 延迟加载图片的 jQuery 插件 - NeoEase Lazy Load 是一个用 JavaScript 编写的 jQuery 插件. 它可以延迟加载长页面中的图片. 在浏览器 ...

  9. Web 开发最有用的 jQuery 插件集锦

    一.Responsive SlideShow--图片滑块展示 1.Responsive Carousel responsive-carousel 是一个内容传送带插件,支持鼠标.触摸和键盘操作.默认包 ...

最新文章

  1. 允许其它网段访问centos服务器_访问控制列表-ACL
  2. C语言经典例73-反向输出一个链表
  3. php 实现心芯图案,利用php输出不同的心形图案
  4. python创建缩略图和选择轮廓效果
  5. vbsedit无法创建空文档_创建恢复驱动器(U盘)
  6. GirlView的分页
  7. 51nod 正整数分组
  8. 无法跳转 vscode_爱了爱了,这个VSCode插件将极大提高你的工mo作yu效率
  9. python的实例属性和静态属性_Python面向对象之静态属性、类方法与静态方法分析...
  10. 【Elasticsearch】使用 Grok 和 Elasticsearch 为数据添加结构
  11. C# 结构体转byte数组 结构体转byte[] 结构体、byte数组互转
  12. 华为服务器修改SN,华为光猫修改双模、SN序号、MAC地址方法
  13. 无胁科技-TVD每日漏洞情报-2022-7-12
  14. 互联网经典算法面试题-验证二叉搜索树
  15. android格式化SD卡,获取其它程序的缓存大小,清理数据
  16. 彼岸花的传说——彼岸繁花,开一千年,落一千年,花叶不相见。情不为因果,缘注定生死。...
  17. openstack-stein.noarch(S版)环境搭建
  18. 阿里云点播录制,上传,播放使用说明及遇到的坑
  19. 【Android】 android | as | android studio 安装与使用
  20. Bellman-ford(解决负权边)

热门文章

  1. es7 async 前置依赖
  2. javascript --- [读书笔记] 回流与重绘 前端优化小结
  3. 配置 --- 将本地项目部署到阿里云上
  4. 1215 - Cannot add foreign key constraint
  5. Linux下进行Web服务器压力(并发)测试工具http_load、webbench、ab、Siege、autobench简单使用教程(转)...
  6. Linux安装glibc(升级版本)
  7. 2013-8-14大一大二暑期组队训练赛
  8. 金山吹响讨伐灰鸽子的号角
  9. ROS与navigation教程——基本导航调整指南
  10. 方差和协方差的数据意义