This time I will bring you jQuery to implement the image magnification function of mouse binding events. What are the precautions for jQuery to implement the image magnification function of mouse binding events. The following is a practical case, let's take a look.
nbsp;html> <meta> <title>jQuery图片变换</title> <style> .show{width:330px; height:auto; margin:50px auto; background:#eee} .item{background:#fff; width:300px; height:auto; float:left; margin:15px;} p{ padding:15px; color:#ff6600} .big-photo img{ width:300px; height:300px; border:1px solid #e0e0e0} .des-small img{ width:30px; height:30px;border:1px solid #e0e0e0; } .des-small img:hover{ border:1px solid #ff6600} .clear{clear:both} </style> <script></script> <script> $(function() { /** 更换小图片 */ $(".item a").hover(function(){ changeImg($(this)) }); }); function changeImg(obj){ if(obj.find("img").attr("alt")=="small"){ var temp_big_src = obj.siblings('a').find('img[alt=big]').attr('src'); var temp_big_url = obj.siblings('a[class=big-photo]').attr('href'); var temp_small_src = obj.find('img').attr('src'); var temp_small_url = obj.attr('href'); obj.siblings('a').find('img[alt=big]').attr('src',temp_small_src); } } </script> <p> </p><p>Jquery实现鼠标移动/移过到商品小图片上时替换掉大图片上的图片</p> <p> <a> <img src="/static/imghwm/default1.png" data-src="WR_00001.jpg" class="lazy" alt="jQuery implements mouse binding event image zoom function" > </a> <a> <img src="/static/imghwm/default1.png" data-src="WR_00002.jpg" class="lazy" alt="jQuery implements mouse binding event image zoom function" > </a> <a> <img src="/static/imghwm/default1.png" data-src="WR_00003.jpg" class="lazy" alt="jQuery implements mouse binding event image zoom function" > </a> <a> <img src="/static/imghwm/default1.png" data-src="WR_00004.jpg" class="lazy" alt="jQuery implements mouse binding event image zoom function" > </a> </p> <p></p>
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
JS Basic Improvement Learning Operation DOM Object Style
js Basic Improvement Learning Basic Data Types
The above is the detailed content of jQuery implements mouse binding event image zoom function. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
