jquery——无缝滚动
无缝滚动:
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>无缝滚动</title>
- <script type="text/javascript" src="jquery-1.12.4.min.js"></script>
- <style type="text/css">
- body,ul,li{
- margin:0;
- padding:0;
- }
- ul{list-style: none;}
- .slide{
- width:500px;
- height:100px;
- border:1px solid #ddd;
- margin:20px auto 0;
- position: relative;
- overflow:hidden;
- }
- .slide ul{
- position: absolute;
- width:1000px;
- height:100px;
- left:0;
- top:0;
- }
- .slide ul li{
- width:90px;
- height:90px;
- margin:5px;
- background-color: antiquewhite;
- line-height: 90px;
- text-align:center;
- font-size:30px;
- float:left;
- }
- .btns{
- width:500px;
- height:50px;
- margin:10px auto 0;
- }
- </style>
- <script type="text/javascript">
- $(function () {
- var $ul = $('#slide ul');
- var left = 0;
- var speed = 2;
- $ul.html($ul.html()+$ul.html());
- var move = function () {
- left-=speed;
- if(left<-500){
- left = 0;
- }
- if(left>0){
- left = -500;
- }
- $ul.css({left:left});
- };
- var timer = setInterval(move,30);
- $('#btn1').click(function () {
- speed = 2;
- });
- $('#btn2').click(function () {
- speed = -2;
- });
- $('#slide').mouseover(function () {
- clearInterval(timer);
- });
- $('#slide').mouseout(function () {
- timer = setInterval(move,30);
- })
- })
- </script>
- </head>
- <body>
- <div class="btns">
- <input type="button" name="" value="向左" id="btn1">
- <input type="button" name="" value="向右" id="btn2">
- </div>
- <div class="slide" id="slide">
- <ul>
- <li>1</li>
- <li>2</li>
- <li>3</li>
- <li>4</li>
- <li>5</li>
- </ul>
- </div>
- </body>
- </html>
效果展示:
jquery——无缝滚动的更多相关文章
- liMarquee – jQuery无缝滚动插件(制作跑马灯效果)
liMarquee 是一款基于 jQuery 的无缝滚动插件,类似于 HTML 的 marquee 标签,但比 marquee 更强大.它可以应用于任何 Web 元素,包括文字.图像.表格.表单等元素 ...
- 利用jQuery无缝滚动插件liMarquee实现图片(链接)和文字(链接)向右无缝滚动(兼容ie7+)
像新闻类的版块经常要求一条条的新闻滚动出现,要实现这种效果,可以使用jQuery无缝滚动插件liMarquee. 注意: 1. 它的兼容性是IE7+,及现代浏览器. 2. 引用的jquery的版本最好 ...
- jquery 无缝滚动 jquery.kxbdmarquee
DEMO http://code.ciaoca.com/jquery/kxbdmarquee/demo/ 官网 http://code.ciaoca.com/jquery/kxbdmarquee/ D ...
- jQuery无缝滚动插件
插件代码 ;(function ($) { // jQuery marquee 插件 $.fn.marquee = function (options) { // 默认设置 var defaults ...
- jquery无缝滚动效果实现
demo如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...
- jQuery无缝滚动向上
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- jquery图片无缝滚动代码左右 上下无缝滚动图片
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- JQuery的无缝滚动
图片无缝向左滚动的代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "h ...
- 自己写了一个无缝滚动的插件(jQuery)
效果图: html代码: 1 <h1>无缝滚动,向右滚动</h1> 2 <ul id="guoul1"> 3 <li><img ...
随机推荐
- BZOJ2212:[POI2011]Tree Rotation
浅谈线段树合并:https://www.cnblogs.com/AKMer/p/10251001.html 题目传送门:https://lydsy.com/JudgeOnline/problem.ph ...
- Poj 2411 Mondriaan's Dream(压缩矩阵DP)
一.Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, ...
- Poj1207 The 3n + 1 problem(水题(数据)+陷阱)
一.Description Problems in Computer Science are often classified as belonging to a certain class of p ...
- 【转】 Pro Android学习笔记(五九):Preferences(3):EditText和Ringtone Preference
目录(?)[-] EditText Preferences xml文件 设备的存贮文件 Ringtone Preferences EditText Preferences xml文件 在res/xml ...
- yum软件包管理器
Yum (Yellow dog Updater, Modified) 黄狗升级器是一个在 Fedora 中的字符前端软件包管理器.基于 RPM 包管理(介绍见RPM包及其管理),能够从指定的服务器自动 ...
- 四 Synchronized
首先,一个问题:一个boolean成员变量,一个方法赋值,一个方法读值,多线程环境下,需要同步吗? 如果用同步的话,读也要用synchroized修饰,因为可见性的问题 需要同步,或者用volatil ...
- 使用root直接安装python3.5.2
操作系统:Centos7.4 不使用pyenv管理器直接进行编译安装3.5.2版本. 下载tgz的包,如果没有安装wget,请yum -y install wget 解压python包: 将解压后的包 ...
- Spring MVC配置详解(3)
一.Spring MVC环境搭建:(Spring 2.5.6 + Hibernate 3.2.0) 1. jar包引入 Spring 2.5.6:spring.jar.spring-webmvc.ja ...
- leetcode笔记-1 twosum
# -*- coding: utf-8 -*- #!/bin/env python # Python2.7 nums = [2, 4, 7, 0, 12, 6] print sorted(range( ...
- android activity生命周期的一张经典图片
图片来自http://blog.csdn.net/android_tutor/article/details/5772285 onpause只有弹出的窗体是Activity的时候才会触发,并非是通过焦 ...