IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

jQuery Discussion :

Drag Maps Le parent bouge aussi


Sujet :

jQuery

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Homme Profil pro
    Etudiant
    Inscrit en
    Octobre 2011
    Messages
    305
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Etudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 305
    Par défaut Drag Maps Le parent bouge aussi
    Bien le bonjour à tous,

    J'ai un souci avec mes deux div, en gros voilà

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <div id="fenetrePrincipale">
    <div id="laBare"></div>
    <div id="laMap"></div>
    </div>
    Je peux faire un drag sur la map et le problème c'est que ainsi sur la fenetrePrincipale, mais le souci quand je fais un drag sur ma map y a toute la fenêtre qui se déplace. donc voila j'aimerai bien que la fentrePrincipale reste fixe quand je fais un drag sur la map

    Merci

  2. #2
    Rédacteur

    Avatar de danielhagnoul
    Homme Profil pro
    Étudiant perpétuel
    Inscrit en
    Février 2009
    Messages
    6 389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 75
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant perpétuel
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2009
    Messages : 6 389
    Billets dans le blog
    125
    Par défaut
    Bonsoir

    UI Draggable : http://jqueryui.com/demos/draggable/

    C'est un peu court comme exemple de code pour travailler sur votre problème.

    Si l'on déplace le parent, il est normal que les enfants suivent, mais pas l'inverse. Voici un exemple :

    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
    <!doctype html>
    <html lang="fr">
    <head>
    	<meta charset="utf-8">
    	<meta name="Author" content="Daniel Hagnoul">
    	<title>Forum jQuery</title>
    	<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/humanity/jquery-ui.css">
    	<link rel="stylesheet" href="http://danielhagnoul.developpez.com/lib/jPicker/css/jPicker.dvjh-1.1.6.min.css" />
    	<style>
    		/* Base */
    		html {font-size:62.5%; } /* Pour 62.5% 1rem =~ 10px */
    		div,p,h1,h2,h3,h4,h5,h6,ul,ol,dl,form,table,img {margin:0; padding:0; }
    		body {background-color:rgb(122, 79, 79); color:#000000; font-family:sans-serif; font-size:1.4rem; font-style:normal; font-weight:normal; line-height:normal; letter-spacing:normal; }
    		h1,h2,h3,h4,h5 {font-family:'Redressed', cursive; padding:0.6rem; }
    		p, div, td {word-wrap:break-word; }
    		pre, code {white-space:pre-wrap; word-wrap:break-word; }
    		img, input, textarea, select {max-width:100%; }
            img {border:none; }
    		h1 {font-size:2.4rem; text-shadow: 0.4rem 0.4rem 0.4rem #bbbbbb; text-align:center; }
    		p {padding:0.6rem; }
    		.conteneur {width:95%; min-width:80rem; min-height:30rem; margin:1.2rem auto; background-color:#ffffff; color:#000000; border:0.1rem solid #666666; }
    		footer {margin-left:3.6rem; }
     
    		/* -- */
    		#draggable1 { width: 150px; height: 150px; padding: 0.5em; }
    		#draggable2 { width: 80px; height: 80px; padding: 0.5em; }
    	</style>
    </head>
    <body>
    	<h1>Forum jQuery</h1>
    	<section class="conteneur">
     
    		<div id="draggable1" class="ui-widget-content">
    			<p>Drag me around</p>
     
    			<div id="draggable2" class="ui-widget-content">
    				<p>Drag me around</p>
    			</div>
     
    		</div>
     
    	</section>
    	<footer itemscope itemtype="http://data-vocabulary.org/Person">
    		<time datetime="2011-10-29T21:00:00.000+02:00" pubdate>2011-10-29</time>
    		<span itemprop="name">Daniel Hagnoul</span>
    		<a href="http://www.developpez.net/forums/u285162/danielhagnoul/" itemprop="url">@danielhagnoul</a>
    	</footer>
    	<script charset="utf-8" src="http://code.jquery.com/jquery-1.7rc1.min.js"></script>
    	<script charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/i18n/jquery-ui-i18n.min.js"></script>
    	<script charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
    	<script charset="utf-8" src="http://danielhagnoul.developpez.com/lib/jPicker/jpicker-1.1.6.min.js"></script>
    	<script>	
    		$(function(){
    			/* -- */
    			$( "#draggable1" ).draggable();
    			$( "#draggable2" ).draggable();
     
    			/* jPicker : http://www.digitalmagicpro.com/jPicker/, outil pour choisir rapidement une couleur */
    			$.fn.jPicker.defaults.images.clientPath="http://danielhagnoul.developpez.com/lib/jPicker/images/";
    			$(".conteneur").jPicker({window:{expandable:true,title:"jPicker : choissisez une couleur :",
    			alphaSupport:true,position:{x:'screenCenter',y:'top'}},color:{ active:new $.jPicker.Color({ r: 210, g: 214, b: 98, a: 128 })}},
    			function(color, context){var c = color.val("all");if (c){$("body").css("backgroundColor", "rgba(" +
    			c.r + "," + c.g + "," + c.b + "," + (c.a/255).toFixed(2) + ")");}});
    		});
    	</script>
    </body>  
    </html>

    Blog

    Sans l'analyse et la conception, la programmation est l'art d'ajouter des bogues à un fichier texte vide.
    (Louis Srygley : Without requirements or design, programming is the art of adding bugs to an empty text file.)

  3. #3
    Membre éclairé
    Homme Profil pro
    Etudiant
    Inscrit en
    Octobre 2011
    Messages
    305
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Etudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 305
    Par défaut
    Dans se cas là que dois-je faire ?

  4. #4
    Rédacteur

    Avatar de danielhagnoul
    Homme Profil pro
    Étudiant perpétuel
    Inscrit en
    Février 2009
    Messages
    6 389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 75
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant perpétuel
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2009
    Messages : 6 389
    Billets dans le blog
    125
    Par défaut
    Vous avez copier-coller et testé ?

    Blog

    Sans l'analyse et la conception, la programmation est l'art d'ajouter des bogues à un fichier texte vide.
    (Louis Srygley : Without requirements or design, programming is the art of adding bugs to an empty text file.)

  5. #5
    Membre éclairé
    Homme Profil pro
    Etudiant
    Inscrit en
    Octobre 2011
    Messages
    305
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Etudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 305
    Par défaut
    Citation Envoyé par danielhagnoul Voir le message
    Vous avez copier-coller et testé ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     $("#laMap").draggable({
     
     $("#fenetrePrincipale").stop();
     
    });
    mais une erreur

    missing : after property id
    [Stopper sur une erreur] $("#fenetrePrincipale").stop();

Discussions similaires

  1. Drag map avec limite
    Par Hotgeart dans le forum jQuery
    Réponses: 7
    Dernier message: 24/06/2013, 16h49
  2. Shadow mapping: ombre qui bouge
    Par zenux dans le forum Moteurs 3D
    Réponses: 2
    Dernier message: 09/12/2012, 22h56
  3. Drag map(div) et map content(image)
    Par faustine dans le forum jQuery
    Réponses: 0
    Dernier message: 18/08/2011, 11h41
  4. Relation Parent/Fils - Mapping et Set
    Par --cycy dans le forum Hibernate
    Réponses: 1
    Dernier message: 17/09/2007, 17h52
  5. [mapping subclass dans la classe parent]
    Par mamata dans le forum Hibernate
    Réponses: 1
    Dernier message: 11/07/2007, 15h28

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo