Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript > Bibliothèques & Frameworks > jQuery
jQuery Forum d'entraide sur le framework jQuery. Avant de poster : Tutoriels jQuery, FAQ jQuery, Tous les tutoriels JavaScript, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 17/01/2011, 23h56   #1
Invité de passage
 
Mike Boutin
Inscription : novembre 2010
Messages : 4
Détails du profil
Informations personnelles :
Nom : Mike Boutin

Informations forums :
Inscription : novembre 2010
Messages : 4
Points : 0
Points : 0
Par défaut Resize avec Jquery

J'aimerais resizer tout mon contenu dynamiquement avec jquery. voici mon code...

Le resize ce fait, mais lorsque je resize les animations font des trucs bizares vu que leur poisition "left" est dynamique avec $(window).width

comment puis-je faire pour regler mon probleme ?

et aussi... lorsque je suis a d'autres position que la premiere place et que je resize la fenêtre, tout ce déplace... comment puis-je faire pour que l'élément sur lequel je suis reste au centre et prend les dimension que je lui donne ?

Merci infiniment de votre aide


Code :
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-ca" ><head> 
	<title> 
	</title> 
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
 
    <meta name="robots" content="index,follow,noodp,noydir">
	<meta name="description" content="">
	<meta name="Revisit-After" content="15days">
	<meta name="keywords" content="creation, site web, quebec, réalisation, Internet, video, corporatif">
	<link rel="index" title="Création de sites web à Québec" href="http://www.unikmedia.ca/">
 
	<link rel="icon" type="image/png" href="***.png" />
	<link rel="stylesheet" media="screen" type="text/css" title="Design" href="***.css" />
	<link rel="stylesheet" media="print" type="text/css" title="Design" href="***.css" />
	<link rel="stylesheet" media="handheld" type="text/css" title="Design" href="***.css" />
	<script type="text/javascript" src="javascript/jquery-1.2.6.min.js"></script>
	<script type="text/javascript" src="javascript/jquery.easing.min.js"></script>
 
	<script type="text/javascript">
		if($(window).height() > 400){
			var docHeight = $(window).height();
			var docHeightMinus = 0 - docHeight;
		}else{
			var docHeight = 400;
			var docHeightMinus = 0 - docHeight;
		}
		if($(window).width() > 800){
			var docWidth = $(window).width();
			var docWidthMinus = 0 - docWidth;
		}else{
			var docWidth = 800;
			var docWidthMinus = 0 - docWidth;
		}
 
        var docWidth = $(window).width();
		var docWidthMinus = 0 - docWidth;
		var docHeightMinus = 0 - docHeight;
		var speed = 300;
 
		$(window).resize(function resizing() {
			positionResize();
		});
 
		$(document).ready(function() {
			positionResize();
 
		});
 
		function positionResize(){
			if($(window).height() > 400){
				var docHeight = $(window).height();
			}else{
				var docHeight = 400;
			}
			if($(window).width() > 800){
				var docWidth = $(window).width();
				var docWidthMinus = 0 - docWidth;
			}else{
				var docWidth = 800;
				var docWidthMinus = 0 - docWidth;
			}
 
			$('#contenu').css({'width':docWidth*6,'height':docHeight});
			$('.imageTableau, .imageTableau img').css({'width':docWidth});
			$('.imageTableau iframe').css({'height':docHeight,'width':docWidth});
 
			$('#image1').click(function(event) {
				$('#contenu').animate(
				{ left: 0 }, { duration: speed, easing: 'backin' })
			});
			$('#image2').click(function(event) {
				$('#contenu').animate(
				{ left: -docWidth }, { duration: speed, easing: 'backin' })
			});
			$('#image3').click(function(event) {
				$('#contenu').animate(
				{ left: -(docWidth*2) }, { duration: speed, easing: 'backin' })
			});
			$('#image4').click(function(event) {
				$('#contenu').animate(
				{ left: -(docWidth*3) }, { duration: speed, easing: 'backin' })
			});
			$('#image5').click(function(event) {
				$('#contenu').animate(
				{ left: -(docWidth*4) }, { duration: speed, easing: 'backin' })
			});
			$('#image6').click(function(event) {
				$('#contenu').animate(
				{ left: -(docWidth*5) }, { duration: speed, easing: 'backin' })
			});
		}
    </script>
</head> 
 
<style>
	html, body {
		margin:0;
		padding:0;
		height: 100%;
		width: 100%;
	}
	#page{
		display:block;
		position:relative;
		overflow:hidden;
		height:100%;
		width:100%;
		min-height:600px;
	}
	#contenu{
		display:block;
		position:absolute;
		top:0px;
		left:0px;
		height:100%;
		width:600%;
	}
	.imageTableau{
		display:block;
		float:left;
		height:100%;
		width:16.6666666666666666%;
	}
	#menu{
		display:block;
		position:absolute;
		top:0px;
		height:50px;
		width:100%;
		background-color:#FF0;
		color:#F00;
		z-index:1;
	}
	.imageTableau img{
		width:100%;
		height:100%;
	}
	.imageTableau iframe{
		display:block;
		position:relative;
	}
</style>
 
 
 
<body>
    <div id="page">
    	<div id="menu">
        	<a href="#" id="image1">1</a>
            <a href="#" id="image2">2</a>
            <a href="#" id="image3">3</a>
            <a href="#" id="image4">4</a>
            <a href="#" id="image5">5</a>
            <a href="#" id="image6">6</a>
        </div>
    	<div id="contenu">
            <div class="imageTableau"><img src="images/IMG_2843.JPG" /></div>
            <div class="imageTableau"><img src="images/IMG_2849.JPG" /></div>
            <div class="imageTableau"><img src="images/IMG_2850.JPG" /></div>
            <div class="imageTableau"><img src="images/IMG_2851.JPG" /></div>
            <div class="imageTableau"><iframe src="http://player.vimeo.com/video/15329264?title=0&amp;byline=0&amp;portrait=0&amp;color=f00024" width="400" height="225" frameborder="0"></iframe></div>
            <div class="imageTableau"><div id="menu" style="margin:auto; display:block; height:300px; width:300px; position:relative; margin-top:200px;"><a href="http://www.google.com">google</a></div></div>
        </div>
 
    </div>
</body> 
 
</html>
mikhellqc est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 23h24.


 
 
 
 
Partenaires

Hébergement Web