首页 技术 正文
技术 2022年11月20日
0 收藏 828 点赞 4,536 浏览 808 个字

点击左右button。实现图片轮播效果。js代码例如以下:

$(function () {
var index = 1;
var pPage = 1;
var $v_citemss = $(".citemss");
var $v_show = $v_citemss.find("ul");
v_width = $v_citemss.width(); //图片展示区外围div的大小 //注:若为整数,前边不能再加var。否则会被提示underfine
p_count = $v_citemss.find("li").length; //获取此处li的个数
$(".slideprev1").click(function () {
if (!$v_show.is(":animated")) {
if (pPage == index) {
$v_show.animate({ right: '0px' }, "3000");
pPage = 4;
} else {
$v_show.animate({ right: '-=' + v_width }, "3000");
pPage--;
}
}
}); $(".slidenext").click(function () {
if (!$v_show.is(":animated")) {
if (pPage == p_count) {
$v_show.animate({ left: '0px' }, "3000");
pPage = 1;
} else {
$v_show.animate({ left: '-=' + v_width }, "3000");
pPage++;
}
}
});});

对于鼠标悬浮上去,下方出现横条描写叙述、左右出现button等效果,全然能够用css实现,不须要使用js来实现了。

详细操作:css中绝对或相对定位,left,right或bottom为负数,鼠标悬浮上去后,分别正确显示,再设置一下transition,作为动画的缓冲就可以。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,035
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,521
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,369
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,150
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,783
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,864