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
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title>Page de test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="jquery/jquery-ui.js"></script>
<link href="jquery/jquery-ui.css" type="text/css" rel="stylesheet"/>
</head>
<script>
$(document).ready(function(){
/** Change le style du menu **/
$("#switchMenuStyle").click(function(){
if ($('#nav').hasClass('icone')) {
$('#nav').animate({
opacity: 0
}, 800, function(){
$(this).removeClass('icone').addClass('list').animate({
opacity: 1
}, 800);
$('#menuType').html('Icone');
$('.tooltype').html('Basculer en mode Icone...');
});
}
else {
$('#nav').animate({
opacity: 0
}, 800, function(){
$(this).removeClass('list').addClass('icone').animate({
opacity: 1
}, 800);
$('#menuType').html('Liste');
$('.tooltype').html('Basculer en mode Liste...');
})
}
});
/** Change le tooltype **/
$("#switchMenuStyle").hover(function(){
if ($('#nav').hasClass('icone')) {
$(this).attr('title', 'Basculer en mode Liste...');
}
else {
$(this).attr('title', 'Basculer en mode Icone...');
};
$('.tooltype').show();
}, function(){
$('.tooltype').hide();
});
/** Création du tooltype **/
$("#switchMenuStyle").mousemove(function(e){
$('.tooltype').css('top', e.pageY + 20);
$('.tooltype').css('left', e.pageX + 20);
});
});
</script>
<style>
/** Type icones **/
ul.icone {
margin: 0;
padding: 0;
list-style: none;
}
ul.icone li {
float: left;
}
ul.icone li a {
display: block;
padding: 0.4em 0.8em;
border: 1px solid #000;
}
/** Type liste **/
ul.list {
}
ul.list li {
list-style: circle;
}
/** Format tooltype **/ .tooltype {
float: left;
position: absolute;
padding: 0.3em;
border: 1px solid #000;
background-color: #c0c0c0;
}
</style>
<div id="conteneur">
<a id="switchMenuStyle" href="#" title="Basculer en mode Liste...">
Changer de style =><span id="menuType">Liste</span>
</a>
<span class="tooltype" style="display:none"/>Basculer en mode Liste...</span>
<br/>
<br/>
<ul id="nav" class="icone">
<li>
<a class="home" href="#" title="">
Accueil
</a>
</li>
<li>
<a class="services" href="#" title="">
Services
</a>
</li>
<li>
<a class="contact" href="#" title="">
Contact
</a>
</li>
</ul>
</div>
</html> |
Partager