金狮镖局 Design By www.egabc.com
这次分享的代码是jQuery插件,HovertreeImg是一个图片轮播jquery插件,使用方便,可以设置大小,圆点位置等,代码简洁
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <base target="_blank" /> <meta charset="utf-8" /> <style>#img {width:768px;height:66px;overflow:hidden} #img img{width:100%;height:100%;} #img #imgcontent{display:none}a{color:blue}</style> </head> <body> <div id="img"> <a href="/h/bjaf/hovertreeimg.htm" title="Img" target="_blank"><img src="/UploadFiles/2021-04-02/img.jpg">jquery.img.js
/*! * HovertreeImg(jQuery Plugin) * version: 1.0.0 * Copyright (c) 2016 HoverTree */ (function ($) { $.fn.hovertreeimg = function (options) { var settings = $.extend({ h_time:"3000",//切换时间 h_borderColor: "transparent",//边框颜色 h_width: "500",//宽度 h_height: "200",//高度 h_circleWidth: "18",//方框边长 h_circleColor:"silver",//圆点颜色 h_currentCircleColor: "red",//当前圆点颜色 h_circlePosition:"right"//圆点位置 }, options); var h_hovertreeimg = $(this); if (h_hovertreeimg.length < 1) return; h_hovertreeimg.css({ "position": "relative", "border":"solid 1px "+ settings.h_borderColor , "width": settings.h_width, "height": settings.h_height , "overflow": "hidden" }) var h_hovertreeimgcontent = h_hovertreeimg.find(">div#hovertreeimgcontent"); h_hovertreeimgcontent.hide(); var h_hovertreeimgcurrent = h_hovertreeimg.find(">a"); h_hovertreeimgcurrent.wrap("<div id='replaceframe'></div>"); h_replaceFrame = h_hovertreeimg.find("#replaceframe").css({ "width": "100%", "height": "100%" }); //构造圆点框 $('<div class="hovertreeimgpoint"></div>').appendTo(h_hovertreeimg); var h_hovertreeimgpoint = h_hovertreeimg.find(".hovertreeimgpoint"); h_hovertreeimgcontent.prepend(h_hovertreeimgcurrent.clone(true));//复制到总a集合 var h_hovertreeimgitems = h_hovertreeimgcontent.children();//所有a标签集合 var h_hovertreeimglength = h_hovertreeimgitems.length;//所有轮播项数量 var h_isswitch = true;//是否轮播 var h_circleWidth = parseInt(settings.h_circleWidth); //加边框与间隔 var h_circleFrameWidth = (h_circleWidth + 4) * h_hovertreeimglength+2; h_hovertreeimgpoint.css({ "height": (h_circleWidth + 4), "position": "absolute", "bottom": "0px", "display": "inline-block" }) //设置圆点位置 switch (settings.h_circlePosition) { case 'right': h_hovertreeimgpoint.css({ "right": "0px" }) break; case 'left': h_hovertreeimgpoint.css({ "left": "0px" }) break; default: h_hovertreeimgpoint.css({ "left": "0px", "right": "0px", "width": h_circleFrameWidth + "px", "margin": "0px auto" }) break; } //切换索引 var h_hovertreeimgindex = 1; if (h_hovertreeimglength < 2) h_hovertreeimgindex = 0; //构造圆点 for (var h_i = 0; h_i < h_hovertreeimglength; h_i++) { h_hovertreeimgpoint.append("<div hovertreeimgdata='" + h_i + "' id='hovertreeimgpoint" + h_i + "'></div>"); } h_pointset = h_hovertreeimgpoint.find("div");//圆点集合 h_pointset.css({ "background-color": settings.h_circleColor, "width": settings.h_circleWidth , "height": settings.h_circleWidth , "border": "1px solid white" , "margin-left": "2px", "display": "inline-block", "border-radius": "50%" }) h_pointset.eq(0).css({ "background-color": settings.h_currentCircleColor }); //设置当前图片 function imgswitch(imgindex) { h_replaceFrame.html(h_hovertreeimgitems.eq(imgindex)); h_pointset.css({ "background-color": settings.h_circleColor }); h_pointset.eq(imgindex).css({ "background-color": settings.h_currentCircleColor }); } h_replaceFrame.find("img").css({ "width": settings.h_width , "height": settings.h_height }) //圆点操作 h_pointset.hover(function () { h_isswitch = false;//光标悬停到圆点停止切换 imgswitch($(this).attr('hovertreeimgdata')); } , function () { h_isswitch = true; } ) //切换 setInterval(function () { if (!h_isswitch) return; imgswitch(h_hovertreeimgindex); h_hovertreeimgindex = (h_hovertreeimgindex + 1) % h_hovertreeimglength; }, settings.h_time) //光标悬停到图片停止切换 h_replaceFrame.hover(function () { h_isswitch = false; }, function () { h_isswitch = true; }) } }(jQuery));
标签:
jQuery,焦点图片轮播
金狮镖局 Design By www.egabc.com
金狮镖局
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
金狮镖局 Design By www.egabc.com
暂无jQuery插件实现带圆点的焦点图片轮播切换的评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
2024年09月24日
2024年09月24日
- 国风大师纯音系列《古筝仙子 常静演奏 十指弹一》1CD[FLAC][919MB]
- DasKapital-OneMustHaveChaosInsidetoGiveBirthtoaDancingStar(2024)[24-44.1]WAV
- 王菲.1999-《只爱陌生人》日本东芝版[低速原抓WAV+CUE]
- 张小英1987-金奖金曲第一集[新加坡版][WAV+CUE]
- 鹿晗.2015-重启【海蝶】【FLAC分轨】
- 张芸京.2012-小女孩【金牌大风】【WAV+CUE】
- 余天.2002-雄狮魅力金曲2CD(南方金点系列)【南方】【WAV+CUE】
- 银霞.1982-《结·SAYYESMYBOY》台湾复刻版[WAV+CUE]
- 梁汉文1993-火热动感[引进版][WAV+CUE]
- 梁汉文2008-EDMONDHITS48[香港]3CD[WAV+CUE]
- 国风大师纯音系列《童丽-[渭城曲]》1CD[WAV分轨][593.5MB]
- 国风大师纯音系列《许菱子《烧筝2》古筝曲集》1CD[WAV分轨][1.3GB]
- 王子异《1996 Part.2》[320K/MP3][18.29MB]
- 群星.1994-宝丽金最倾情3CD【宝丽金】【WAV+CUE】
- 乐俊亨.2024-同泪【CharioticMusic】【FLAC分轨】