search
HomeWeb Front-endHTML TutorialAlthough I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose

nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



{title}_懒人图库





<script></script>
<script> <br /> $(function() { <br /> var sWidth = $("#focus").width(); //获取焦点图的宽度(显示面积) <br /> var len = $("#focus ul li").length; //获取焦点图个数 <br /> var index = 0; <br /> var picTimer; <br /> <br /> //以下代码添加数字按钮和按钮后的半透明长条 <br /> var btn = "<div class='btnBg'><div class='btn'>"; <br /> for(var i=0; i < len; i++) { <br /> btn += "<span>" + (i+1) + ""; <br /> } <br /> btn += "" <br /> $("#focus").append(btn); <br /> $("#focus .btnBg").css("opacity",0.5); <br /> <br /> //为数字按钮添加鼠标滑入事件,以显示相应的内容 <br /> $("#focus .btn span").mouseenter(function() { <br /> index = $("#focus .btn span").index(this); <br /> showPics(index); <br /> }).eq(0).trigger("mouseenter"); <br /> <br /> //本例为左右滚动,即所有li元素都是在同一排向左浮动,所以这里需要计算出外围ul元素的宽度 <br /> $("#focus ul").css("width",sWidth * (len + 1)); <br /> <br /> //鼠标滑入某li中的某div里,调整其同辈div元素的透明度,由于li的背景为黑色,所以会有变暗的效果 <br /> $("#focus ul li div").hover(function() { <br /> $(this).siblings().css("opacity",0.7); <br /> },function() { <br /> $("#focus ul li div").css("opacity",1); <br /> }); <br /> <br /> //鼠标滑上焦点图时停止自动播放,滑出时开始自动播放 <br /> $("#focus").hover(function() { <br /> clearInterval(picTimer); <br /> },function() { <br /> picTimer = setInterval(function() { <br /> if(index == len) { //如果索引值等于li元素个数,说明最后一张图播放完毕,接下来要显示第一张图,即调用showFirPic(),然后将索引值清零 <br /> showFirPic(); <br /> index = 0; <br /> } else { //如果索引值不等于li元素个数,按普通状态切换,调用showPics() <br /> showPics(index); <br /> } <br /> index++; <br /> },3000); //此3000代表自动播放的间隔,单位:毫秒 <br /> }).trigger("mouseleave"); <br /> <br /> //显示图片函数,根据接收的index值显示相应的内容 <br /> function showPics(index) { //普通切换 <br /> var nowLeft = -index*sWidth; //根据index值计算ul元素的left值 <br /> $("#focus ul").stop(true,false).animate({"left":nowLeft},500); //通过animate()调整ul元素滚动到计算出的position <br /> $("#focus .btn span").removeClass("on").eq(index).addClass("on"); //为当前的按钮切换到选中的效果 <br /> } <br /> <br /> function showFirPic() { //最后一张图自动切换到第一张图时专用 <br /> $("#focus ul").append($("#focus ul li:first").clone()); <br /> var nowLeft = -len*sWidth; //通过li元素个数计算ul元素的left值,也就是最后一个li元素的右边 <br /> $("#focus ul").stop(true,false).animate({"left":nowLeft},500,function() { <br /> //通过callback,在动画结束后把ul元素重新定位到起点,然后删除最后一个复制过去的元素 <br /> $("#focus ul").css("left","0"); <br /> $("#focus ul li:last").remove(); <br /> }); <br /> $("#focus .btn span").removeClass("on").eq(0).addClass("on"); //为第一个按钮添加选中的效果 <br /> } <br /> }); <br /> <br /> </script>




jQuery淘宝商城多格焦点图效果






  • Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose


    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose

    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose

    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose




  • Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose




  • Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose


    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose

    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose

    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose




  • Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose

    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose

    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose

    Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose





  • Although I downloaded some focus map codes from the Internet to study, I still don't understand them well. Can any experts give me some formulas? _html/css_WEB-ITnose






说明:

来源:淘宝商城  代码整理:54173BLOG  首发:懒人图库

*尊重他人劳动成果,转载请自觉注明出处!注:此代码仅供学习交流,请勿用于商业用途。

{download}

{content}

{google_729x90}






I downloaded this code online and can only understand the following parts of , Although some of the above have comments and are very clear, but what I know more is, how to understand these codes? Or should I just memorize it by rote?


Reply to discussion (solution)

style type="text/css">
* {margin:0; padding:0; }
body {font-size:12px; color:#222; font-family:Verdana,Arial,Helvetica,sans-serif; background:#f0f0f0;}
.clearfix:after {content: "." ; display: block; height: 0; clear: both; visibility: hidden;}
.clearfix {zoom:1;}
ul,li {list-style:none;}
img {border: 0;}

.wrapper {width:600px; margin:0 auto; padding-bottom:50px;}
.ad {width:468px; margin:10px auto 0;}
.ad li {padding-top:5px;}

h1 {height:50px; line-height:50px; font-size:22px; font-weight:normal; font-family:"Microsoft YaHei",SimHei; }

.shuoming {margin-top:20px; border:1px solid #ccc; padding-bottom:10px;}
.shuoming dt {height:30px; line-height:30px; font-weight :bold; text-indent:10px;}
.shuoming dd {line-height:20px; padding:5px 20px;}

.wrapper {width:780px;}
/* tmall focus */
#focus {width:780px; height:380px; overflow:hidden; position:relative;}
#focus ul {height:380px; position:absolute;}
#focus ul li {float :left; width:780px; height:380px; overflow:hidden; position:relative; background:#000;}
#focus ul li div {position:absolute; overflow:hidden;}
#focus .btnBg {position:absolute; width:780px; height:40px; left:0; bottom:0; background:#000;}
#focus .btn {position:absolute; width:770px; height:24px; left:0 ; bottom:8px; padding-left:10px;}
#focus .btn span {display:inline-block; _display:inline; _zoom:1; width:24px; height:24px; line-height:24px; text -align:center; font-size:20px; font-family:"Microsoft YaHei",SimHei; margin-right:10px; cursor:pointer; color:#fff;}
#focus .btn span.on {background :#000; color:#fcc;}


is the special effect of JavaScript.
The example you posted quoted the js library--jquery.
The poster can learn from it
http://www.w3school.com.cn/jquery/index.asp

Thank you for your help, the website explains it in detail!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Mar 04, 2025 pm 12:32 PM

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

How do I use HTML5 form validation attributes to validate user input?How do I use HTML5 form validation attributes to validate user input?Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

What are the best practices for cross-browser compatibility in HTML5?What are the best practices for cross-browser compatibility in HTML5?Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

How to efficiently add stroke effects to PNG images on web pages?How to efficiently add stroke effects to PNG images on web pages?Mar 04, 2025 pm 02:39 PM

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

What is the purpose of the <datalist> element?What is the purpose of the <datalist> element?Mar 21, 2025 pm 12:33 PM

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <progress> element?What is the purpose of the <progress> element?Mar 21, 2025 pm 12:34 PM

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

How do I use the HTML5 <time> element to represent dates and times semantically?How do I use the HTML5 <time> element to represent dates and times semantically?Mar 12, 2025 pm 04:05 PM

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

What is the purpose of the <meter> element?What is the purpose of the <meter> element?Mar 21, 2025 pm 12:35 PM

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment