jquery实现新闻滚动

jquery实现新闻消息滚动 html代码: <div class="root"> <div class="mainleft"> <span>今日消息</span> </div> <div class="mainright"> <ul> <li>hjkdfhkh-lkj- lkdj开发完成</li> 阅读详情

首先需要jquery的框架支持(这点博客已经具备了jquery的环境,可以不管),在你想要添加效果的页面里面的<head></head>之间添加如下功能函数:

JavaScript代码
  1. <script type="text/javascript">
  2. function AutoScroll(obj){
  3.         $(obj).find("ul:first").animate({
  4.                 marginTop:"-25px"
  5.         },500,function(){
  6.                 $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
  7.         });   
  8. }
  9. </script>

  这个就是滚动函数,里面的 marginTop:"-25px" 这个25px为你定义的每一行新闻的高度,一般默认就行!然后再页面中任何位置,就是你想要实现滚动新闻的位置添加新闻的代码:

XML/HTML代码
  1. <div id="scrollDiv">  
  2.   <ul>  
  3.     <li>这是滚动新闻的第一行</li>  
  4.     <li>这是滚动新闻的第二行</li>  
  5.     <li>这是滚动新闻的第三行</li>  
  6.     <li>这是滚动新闻的第四行</li>  
  7.     <li>这是滚动新闻的第五行</li>  
  8.     <li>这是滚动新闻的第六行</li>  
  9.     <li>这是滚动新闻的第七行</li>  
  10.     <li>这是滚动新闻的第八行</li>  
  11.   </ul>  
  12. </div>  

  注意,这里的 id="scrollDiv"是必须的,最后针对这个div框架添加滚动的效果,就是在页面的最底部,或者<head></head>之间添加:

JavaScript代码
  1. <script type="text/javascript">   
  2. $(document).ready(function(){   
  3. setInterval('AutoScroll("#scrollDiv")',1000)   
  4. });   
  5. </script>  

  这里的AutoScroll就是开始添加的功能函数,括号里面的”#scrollDiv“就是滚动新闻的div的id名称,可以自由设置,但这2个地方一定要保持一致!

  最后对这个div添加css样式代码:

CSS代码
  1. <style type="text/css">   
  2. ul,li{margin:0;padding:0}   
  3. #scrollDiv{width:300px;height:25px;line-height:25px;border:#ccc 1px solid;overflow:hidden}   
  4. #scrollDiv li{height:25px;padding-left:10px;}   
  5. </style>  

  这样就完成了,更新一下首页即可看到效果了,在给出的效果预览里面还有多行滚动,还有可控制上下滚动的效果,大家可以多尝试一下其他的效果!代码不多,但是效果蛮不错的!可以有很好的用户体验效果!

创建动态的向上滚动新闻列表 本文还有配套的精品资源,点击获取 简介:利用jQuery创建一种动态的新闻列表滚动效果,新闻列表垂直向上逐条滚动,提供良好的用户体验并有效展示信息。本项目涵盖了HTML结构设计、CSS样式设置、jQuery脚本编写,以及实现平滑动画和交互控制的基本步骤。通过定时器和jQuery动画方法,可以实现新闻的逐条滚动,并支持交互功能,如暂停和恢复滚动。 1. jQuery... 阅读详情

相关推荐

jQuery实现网站新闻公告自动左右滚动切换特效

在构建滚动组件时,首先需要确立整体结构的语义边界。通常建议使用<section>或作为最外层容器,以表明这是一个独立的功能模块。内部则嵌套一个用于裁剪可视区域的viewport容器,并在其内放置实际滚动的内容块。<section class="news-ticker" aria-label="最新公告滚动区域"><h2 class="sr-only">最新公告</h2>

weixin_32389853的博客 1100

jquery 文本上下无缝滚动,鼠标放上去就停止

function AutoScroll(obj) {             $(obj).find("ul:first").animate({                 marginTop: "-25px"             }, 500, function () {                 $(this).css({ marginTop: "0px" }).find

LYBWWP 2630

jQuery滚动公告

jQuery animate封装向上滚动插件,使用定时器setInterval调用封装的插件实现滚动公告

JQuery——BreakingNews.js新闻滚动效果

BreakingNews.js新闻列表滚动效果

NanChen的博客 1082

jquery新闻公告滚动效果

jquery新闻公告滚动效果

jQuery实现新闻播报滚动及淡入淡出效果示例

主要介绍了jQuery实现新闻播报滚动及淡入淡出效果,结合实例形式分析了基于jQuery插件的页面元素动态变换相关操作技巧,需要的朋友可以参考下

推荐一款优秀的 jQuery 新闻滚动插件 - jQuery News Ticker

推荐一款优秀的 jQuery 新闻滚动插件 - jQuery News Ticker 项目简介 是一个轻量级的 jQuery 插件,它可以帮助您在网站上创建新闻滚动条,为您的用户提供实时更新的内容。 项目用途 jQuery News Ticker 可以用于展示最新新闻、公告、促销信息等,让用户在浏览网页的同时获取到最新的动态。您可以将它应用于各种类型的网站中,如新闻门户、企业官网、博客等。 项目特...

gitblog_00002的博客 595

jQuery实现公告新闻自动滚屏效果实例代码

主要介绍了jQuery实现公告新闻自动滚屏效果实例代码的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下

JQuery实现导航效果、新闻滚动、广告效果、横向滚动

1、导航效果 2、新闻滚动(跑马灯) 3、广告效果 4、新款上市模块横向滚动 1、导航效果 图1.1 导航效果 1.1 导航样式 /*导航样式开始*/ #navigation { width:784px; padding:8px; margin:8px auto; background:#3B5998;height:18p

pan_junbiao的博客 1万+

大华/华睿工业相机(摄像头)链接电脑,并用OpenCV打开

睿科是大华旗下机器视觉子公司,现在工业相机一般是华睿在产,要下载驱动程序,要到华睿官网哪里下载。由于我的电脑没有摄像头,所以摄像头序列化为0,电脑的第一个摄像头默认为0,序列号是0,1,2,3……,你是什么接口连接的就选择什么, 建议直接全选。我这里选择第二个,下载后点击安装,的你要点击识别右侧设置,设置。这个过程很简单,故不赘述。打开你的设备会在右边显示。

qq_48050838的博客 1万+

(详细教程)opencv+pycharm+笔记本摄像头 做一个人脸识别

文章目录 前言 一、pandas是什么? 二、使用步骤 1.引入库 2.读入数据 总结 一、安装opencv-python 这里推荐使用pycharm直接安装opencv-python 打开文件——设置——python解释器——点击+号 搜索opencv-python,点击安装包,等待片刻即可安装好 检查是否安装好,新建一个项目输入以下代码,若无报错则安装好 import cv2 二、准备分类器 咱们使用opencv官方提供的分类器,包括面部识别,侧...

qq_52852432的博客 1万+

html实现新闻滚动效果,jQuery实现新闻播报滚动及淡入淡出效果示例

这篇文章主要介绍了jQuery实现新闻播报滚动及淡入淡出效果,结合实例形式分析了基于jQuery插件的页面元素动态变换相关操作技巧,需要的朋友可以参考下本文实例讲述了jQuery实现新闻播报滚动及淡入淡出效果。分享给大家供大家参考,具体如下:下面是上下滚动源码www.jb51.net 向上滚动代码带上下翻按钮滚动特效body{ color:#333; font-size:13px;}h3,ul,l...

weixin_26841957的博客 1210

3D Slicer隐藏技巧:这样玩转医学影像分割与3D建模(含DICOM处理)

本文深入探讨3D Slicer在医学影像分割与3D建模中的高级应用技巧,包括多模态分割策略、三维可视化优化及DICOM数据处理。通过专业配置和Python脚本示例,帮助医疗AI开发者和影像科医师提升工作效率,实现精准的医学图像分析与建模。

weixin_28559803的博客 433

新闻滚动效果JQuery实现

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <...

weixin_30915275的博客 156

LangChain学习及应用(超详细)

Model I/O 部分是与语言模型进行交互的核心组件,包括输入提示(Prompt Template)、调用模型(Model)、输出解析(Output Parser)。简单来说,就是输入、处理、输出这三个步骤。LLM 因其具有海量参数,需要花费相当的物力与时间成本进行预训练和微调,同时商用 LLM 还需要进行各种安全测试与风险评估等。因此 LLM 会存在知识滞后的问题。在专有领域,LLM 无法学习到所有的专业知识细节,因此在面向专业领域知识的提问时,无法给出可靠准确的回答。

weixin_39764056的博客 4252

uniapp - Invalid value “iife” for option “output.format” - UMD and IIFE output formats are not suppo

Invalid value “iife” for option “output.format” - UMD and IIFE output formats are not supported for code-splitting builds. uniapp 编译报错,vite vue3 Hbuilder 中编译报错,uniapp 打包 App 报错(vue3)hbuilder提示错误,uniapp运行到手机/模拟器 App 报错(vue3)uniapp项目启动报错,如何解决这个问题,安卓app,苹果app

🏆 前端领域优质创作者 3965

jquery实现QQ新闻图片滚动

最近有个做的一个网站中有个小模块需要实现类似qq新闻图片的滚动的东东。由于对jquery不是很了解,就拿着jquery手册试着写了个。贴出来,纪念下。前台代码:中北文化网

hookyzlr的专栏 1897

Yocto系列讲解[入门篇] 1 - 快速入门熟悉Yocto的构建

yocto quick start up带大家快速上手

fulinux的博客 5万+

Jquery 实现新闻列表的滚动

Jquery 实现新闻列表的滚动            //1、鼠标移入移出事件,定义定时器时间            //2、鼠标移入,停止新闻滚动,清除定时器            //3、鼠标移出,定时器开始使新闻滚动,定义定时器            //4、显示图片效果(a获取第一行ul,b获取li行高,c动画将ul上移一个li的行高,显示出第二个li,d动画执行完后将第一个li追加移动...

Carina的编程技术博客 3798

【QNX+Android虚拟化方案】129 - USB眼图参数配置

【QNX+Android虚拟化方案】129 - USB眼图参数配置

|~~~热爱生活、努力学习的小伙汁~~~| 821

AUTOSAR进阶图解==>AUTOSAR_SWS_COM

AUTOSAR COM模块是AUTOSAR通信堆栈的核心组件,提供信号导向的通信服务。该模块位于通信服务层,连接RTE与PDU Router,主要功能包括信号封装/提取、传输模式管理、信号路由、超时监控和字节序转换等。COM模块架构分为应用层、通信服务层和通信抽象层,包含信号管理、I-PDU处理、传输模式管理等组件。其配置结构包括顶层容器、I-PDU组、I-PDU和信号等多层次配置对象,支持丰富的参数设置。模块采用严格的状态管理机制,包括模块状态和I-PDU组状态转换,确保通信可靠性。

一名留德华的,康德的信徒的,专注于汽车电子领域的博客 1244

jQuery实现类似新闻的自动滚动

前段时间,一朋友问我,有没有类似于新闻自动滚动的JS代码,我想了想,没有,就随手帮朋友写了个jQuery的扩展给他用。 先上Html代码: ul{width:20%;height:100px;overflow:hidden;} li{line-height:20px

小小青叶 1758

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

jQuery实现多行新闻滚动

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/1999/xhtml">多行滚动jQuery循环新闻列表代码ul,li{margin:0;padding:0}#scrollDiv{width:300px;height:100px;min-height:25px;line-height:25px;b

暗淡亮点的博客 809

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

基于jQuery实现滚动新闻代码下载

分享一款基于jQuery实现滚动新闻代码下载。这是一款基于bootstrup 3实现的响应式jQuery滚动新闻插件。效果图如下: 在线预览源码下载 实现的代码。 html代码: <div class="htmleaf-container"> <header class="htmleaf-header bgcolor-10"> ...

weixin_30248399的博客 134

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

php自动滚动播放新闻,jQuery实现列表自动滚动循环滚动展示新闻

需要在页面中一个小的区域循环滚动展示新闻(公告、活动、图片等等),并且,鼠标悬停时停止滚动并提示,离开后,继续滚动。效果图:上干货html:aaaaaaaaaaaaaaabbbbbbbbbbbbbbbcccccccccccccccdddddddddddddddeeeeeeeeeeeeeeefffffffffffffffgggggggggggggggcss:ui,li {list-style: no...

weixin_34696006的博客 317
上一篇: 实现文件上传
下一篇: jQuery-对Select的操作集合
chenndd
博客等级 码龄17年 13粉丝 12原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值