1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
<!Doctype HTML>
<html>
<head>
<style type="text/css">
article {width:400px;height: 200px;margin:0;padding:0;background:azure;}
figure, .txt { float:left;}
figure {width:150px;height:150px;margin:0;}
figure a{display:block; width:150px;height:150px;text-decoration:none;}
figure img {width:150px;height:150px;border:none;}
.txt {width: 200px; height:150px;margin-left: 40px; background:blanchedalmond;}
.txt h1 a{color:red;text-decoration:none;font-size:16px;}
.txt h1 a:hover{color:green;}
</style>
</head>
<body>
<article class="art">
<figure class="figure">
<a href="article.html"><img src="01.png"></a>
</figure>
<div class="txt">
<h1><a href="article.html">Title one</a></h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</article>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('figure').mouseover(function () {
$(this).parent('article.art').find('.txt h1 a').css("color", "green");
})
.mouseout(function () {
$(this).parent('article.art').find('.txt h1 a').css("color", "red");
});
$('.txt h1').mouseover(function () {
$(this).find('a').css("color", "green");
})
.mouseout(function () {
$(this).find('a').css("color", "red");
});
});
</script>
</body>
</html> |
Partager