当鼠标悬停在一个小图像上时,它将显示一个大图像 [英] while mouse over a small image it will shows a large image
本文介绍了当鼠标悬停在一个小图像上时,它将显示一个大图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果鼠标悬停在一个小图像上,如何获取大图像plz帮助我,如果可能.............
解决方案
使用jQuery很容易:
< html >
< head >
< title > ... < / title >
< < span class =code-leadattribute> script type = text / javascript src = scripts / jquery -1.7.1.min.js > < / script >
< / head >
< 正文 >
< img alt = 图片 id = image / >
< script type = text / javascript >
( document )。ready( function (){
imageElement =
( #图像跨度>); // 元素img由其属性id =image找到
imageElement.attr(< span class =code-string> src, small.png跨度>); // 以小图片开头
imageElement.hover(
function (){ // 鼠标在图像上移动
how to get large image while mouse over a small image plz help me if u possible.............
解决方案
It's easy with jQuery:
<html> <head> <title> ... </title> <script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script> </head> <body> <img alt="Image" id="image" /> <script type="text/javascript">
(document).ready(function() { imageElement =
("#image"); // element img found by its attribute id="image" imageElement.attr("src", "small.png"); // start with small image imageElement.hover( function() { // mouse moves over the image
这篇关于当鼠标悬停在一个小图像上时,它将显示一个大图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文