<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Rollover Images</title>
<style>
html , body{
line-height: 1;
background-color: #334873;
}
h1 {
font-family: 'ColaborateRegular', Arial, sans-serif;
}
p {
font-family: 'ColaborateRegular', Arial, sans-serif;
color: white;
}
.logo {
letter-spacing: -1px;
color: rgb(195,151,51);
text-shadow: 2px 2px 1px rgba(0,0,0,.25);
font: normal 54px 'ColaborateThinRegular', Arial, sans-serif;
}
#gallery img {
display: inline-block;
margin: 10px;
border: 1px solid rgb(0,0,0);
}
</style>
<script src="js/jquery-1.7.2.min.js"></script>
<script>
$(ducument).ready(
);//end ready
</script>
</head>
<body>
<div class="wrapper">
<div class="header">
<p class="logo">Easy Sir</p>
</div>
<div class="content">
<div class="main">
<h1>Rollover Images</h1>
<p>Mouse over the images below</p>
<div id="gallery">
<a href="images/blue.jpg"><img src="images/blue.jpg" width="70" height="70" alt="blue">
</a>
<a href="images/green.jpg"><img src="images/green.jpg" width="70" height="70" alt="green">
</a>
<a href="images/orange.jpg"><img src="images/orange.jpg" width="70" height="70" alt="orange">
</a>
<a href="images/purple.jpg"><img src="images/purple.jpg" width="70" height="70" alt="purple">
</a>
<a href="images/red.jpg"><img src="images/red.jpg" width="70" height="70" alt="red">
</a>
<a href="images/yellow.jpg"><img src="images/yellow.jpg" width="70" height="70" alt="yellow"></a>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
$(document).ready(function(){
$('#gallery img').each();
});//end ready
</script>
<script>
$(document).ready(function(){
$('#gallery img').each(function(){
var oldSrc = $(this).attr('src');
var newPic = new Image();
var imgExt = /(\.\w{3,4}$)/;
newPic.src = oldSrc.replace(imgExt, '_h$1');
});
});//end ready
</script>
var newImg = new Image();
newImg.src = 'images/newImage.jpg';
$('#pic1').attr({
src: newImg.src,
width: newImg.width,
height: newImg.height
});
$(document).ready(function(){
$('#gallery img').each(function(){
var oldSrc = $(this).attr('src');
var newPic = new Image();
var imgExt = /(\.\w{3,4}$)/;
newPic.src = oldSrc.replace(imgExt, '_h$1');
$(this).hover(
function(){
$(this).attr('src', newPic.src);
},
function(){
$(this).attr('src', oldSrc);
}
);//end hover
});
});//end ready
$(document).ready(function(){
...//省略未改动部分
$('#gallery a').click(function(evt){
evt.preventDefault();
});//end click
});//end ready
<div id="gallery"> <a href="images/blue.jpg"><img src="images/blue.jpg" width="70" height="70" alt="blue"></a> <a href="images/green.jpg"><img src="images/green.jpg" width="70" height="70" alt="green"></a> <a href="images/orange.jpg"><img src="images/orange.jpg" width="70" height="70" alt="orange"></a> <a href="images/purple.jpg"><img src="images/purple.jpg" width="70" height="70" alt="purple"></a> <a href="images/red.jpg"><img src="images/red.jpg" width="70" height="70" alt="red"></a> <a href="images/yellow.jpg"><img src="images/yellow.jpg" width="70" height="70" alt="yellow"></a> </div> <div id="bigImg"><div>
...//省略未改动部分
$('#gallery a').click(function(evt){
evt.preventDefault();
var imgPath = $(this).attr('href');
var newImg = $('<img src="' + imgPath + '">');
newImg.hide();
$('#bigImg').prepend(newImg);
newImg.fadeIn(1000);
});//end click
...//省略未改动部分
$('#gallery a').click(function(evt){
evt.preventDefault();
var imgPath = $(this).attr('href');
var oldImg = $('#bigImg img');
var newImg = $('<img src="' + imgPath + '">');
newImg.hide();
$('#bigImg').prepend(newImg);
newImg.fadeIn(1000);
oldImg.fadeOut(1000, function(){
$(this).remove();
});
});//end click
...//省略未改动部分
$('#gallery a').click(function(evt){
evt.preventDefault();
var imgPath = $(this).attr('href');
var oldImg = $('#bigImg img');
var newImg = $('<img src="' + imgPath + '">');
newImg.hide();
$('#bigImg').prepend(newImg);
newImg.fadeIn(1000);
oldImg.fadeOut(1000, function(){
$(this).remove();
});
});//end click
$('#gallery a:first').click();
#bigImg img {
position: absolute;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有