Bonjour à tous,

Dans mon code suivant j'aimerais afficher une image au chargement de la page, puis traiter la sélection/désélection du premier titre.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> 
<head> 
	<title>CSS Hover</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<meta name="description" lang="fr" content="CSS-jQuery Jover" /> 
	<style type="text/css" media="screen"> 
 
* {
	font-family : Verdana, Arial;
}
 
.articles {
	font-size : 13px;
	position : relative;
	border : 1px solid #e0e0e0;
	width : 352px;
	height : 126px;
	margin : auto;
	padding : 1px;
}
 
.articles ul{
	width:190px;
	height:128px;
	padding:0;
	list-style-type:none;
	list-style-position:outside;
	margin : 0 ;
	visibility: visible;
}
.articles li {
	/*position : relative;*/
	margin: 0;
	cursor : pointer;
}
.articles li a {
  text-decoration : none;
  color : #ebfff3;  
  font-size : 13px;  
  background-color : #7385a3;
  /*border : 1px solid #7385a3;*/
  border-right: #fff 1px solid;
  border-bottom: #fff 1px solid; 	
  display : block;
  padding : 2px;
  height : 37px;
  line-height : 10px;
}
.articles li a:hover{
	background-color: #99a6bd;
 
}  	
.articles .nimg {
	position:absolute;
	left:190px;
	top:0; right:0;
	background-color : #fff;
	padding : 1px;
}
.articles .imag {
    height: 126px;
    width: 162px;
	position:absolute;
	left:192px;
	top:0; right:0;
	background-color : #fff;
	padding : 1px;
}
.articles li img {
  display : none;
 
}
 
.articles li:hover img {
    display: block;
    z-index: 100;
	left: 190px;
    position: absolute;
    top:0; right:0;
}
.articles .where{
  position : absolute;
  color : #e0e0e0;
  background-color : #fff;
  border : 1px solid #e0e0e0;
  padding:1px;
}
.articles li:hover div {
  position : absolute;
  display : block;
}
.articles li a.selected {
	background-color: #bec6d5;
	border-right: #fff 1px solid;
	border-bottom: #fff 1px solid;
}
 
</style>
</head>
<body>
<div id="titre">
<h2>Hover en CSS</h2>
</div>
<div class="articles">
  <ul>
    <li><img class="imag" src="facebook.jpeg"><a class="selected" href="#">Facebook déclare ouvertement la guerre à Google</a></li>
    <li><img class="imag" src="numericable.jpeg"><a href="#">Numericable lance une offre mobile illimitée à 24,90 euros</a></li>
    <li><img class="imag" src="google.jpeg"><a href="#">Les ordinateurs portables Chromebooks de Google arriveront le 15 juin</a></li>
  </ul>
</div>
<br /><br />
<div class="articles">
  <ul>
    <li><img class="imag" src="facebook.jpeg"><a class="selected" href="#">Facebook déclare ouvertement la guerre à Google</a></li>
    <li><img class="imag" src="numericable.jpeg"><a href="#">Numericable lance une offre mobile illimitée à 24,90 euros</a></li>
    <li><img class="imag" src="google.jpeg"><a href="#">Les ordinateurs portables Chromebooks de Google arriveront le 15 juin</a></li>
  </ul>
</div>
 
<script charset="utf-8" src="jquery-1.6.min.js"></script>
	<script type="text/javascript"> 
        $(function(){
            $(".articles").children("li").mouseenter(function(){
                var objParentArticles = $(this).closest(".articles");
                objParentArticles.find("a.selected").removeClass("selected");
 
                $(this).next("img").css("display:block");
                $(this).next("a").addClass("selected");
            });
        });
	</script> 
 
</body>
</html>
Merci d'avance.