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

Bibliothèques & Frameworks Discussion :

Carousel horizontal passer en vertical


Sujet :

Bibliothèques & Frameworks

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    5
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 5
    Par défaut Carousel horizontal passer en vertical
    Tout d'abord bonjour,

    voilà, j'ai un script d'un module joomla qui defile de façon horizontal certains éléments...
    pour modifier se mouvement en vertical, j'ai "je pense" trouvé l'astuce de faire un "remplacer par" tous les width avec les height et inversement de façon propre dans le php.

    ce script modifié fonctionne bien maintenant sous firefox, mais il se lance de façon très aléatoire à mon goût sous Chrome...

    suis-je dans le vrai où ai-je fais une belle erreur?

    ICI LE PHP :
    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
     
    <?php
     
    defined('_JEXEC') or die();
     
    JHTML::stylesheet('css/mod_jea_slide_swc.css', 'modules/mod_jea_slide_swc/');
    $charset = strtoupper(JFactory::getDocument()->getCharset());
    $nimage=$params->get('number_image', 2);
    $wimage=$params->get('thumb_Height', 200);
    $time_interval=$params->get('time_interval', 4000);
    $time_speed=$params->get('slide_speed', 700);
    $mod_Height=($wimage*$nimage)+($nimage*10)-10;
    if ( $params->get('show_arrows', 1)) {$margin="50px";};
     
     
    ?>
    <div id="titrenouveautes"></div>
    <script type="text/javascript">
    		window.addEvent("domready", function() {
        var slide_jea_swc = new slideGallery($$(".mod_jea_slide_swc"), {
    				steps: <?php echo $nimage; ?>,
    				mode: "circle",
    				random: true,
    				autoplayOpposite: true,
    				stop: ".stop",
    				start: ".start",
    				duration: <?php echo $time_interval; ?> ,
    				speed: <?php echo $time_speed; ?>
    			});
    	});
    	</script>
     
     
     
     
     <div class="mod_jea_slide_swc" >
        <?php if ( $params->get('show_arrows', 1)) : ?>
    				<a href="#" class="jea_slide_swc_prev"></a>
    				<a href="#" class="jea_slide_swc_next"></a>
    	<?php endif ?>			
     
    			<div class="jea_holder_swc" style="Height:<?php echo $mod_Height; ?>px;">
                <ul style="margin:0px; padding:0px; list-style: none; Height: 30000px;">
        <?php foreach ($rows as $k => $row) : $url = modJeaSlideSwcHelper::getPropertyRoute($row) ?>
     
     
     
      <?php if ($params->get('show_details', 1)): ?>
     
     
        <li><?php if ( $params->get('show_thumbnails', 1) && $imgUrl = modJeaSlideSwcHelper::getItemImg($row)) : ?>
        <a href="<?php echo $url ?>" title="<?php echo JText::_('COM_JEA_DETAIL') ?>" >
        <img style="Height:auto" src="<?php echo $imgUrl ?>" alt="<?php echo JText::_('COM_JEA_DETAIL') ?>" /></a>
     
        <?php 
        if (empty($row->title)) {
            echo JText::sprintf('COM_JEA_PROPERTY_TYPE_IN_TOWN', 
                                 htmlspecialchars($row->type, ENT_COMPAT, $charset), 
                                 htmlspecialchars($row->town, ENT_COMPAT, $charset));
        } else {
            echo htmlspecialchars($row->title, ENT_COMPAT, $charset);
        } ?><br/>
     
     
        <?php if (!empty($row->living_space)): ?>
        <?php echo  JText::_('COM_JEA_FIELD_LIVING_SPACE_LABEL') ?> : <strong>
        <?php echo JHtml::_('utility.formatSurface', (float) $row->living_space , '-' ) ?>
        </strong>
        <?php endif ?>
     
    	<br/>
        <br />
        <p></p>
        <?php endif ?>
     
     
      <?php endif ?>
     </li>
    <?php endforeach ?></ul>
     <?php $swc ='PGRpdiBjbGFzcz0ic3djX2ZvdCI+PGEgdGl0bGU9IkNyZWF6aW9uZSBTaXRpIFdlYiIgaHJlZj0iaHR0cDovL3d3dy5zaXRpd2ViLmNhZ2xpYXJpLml0IiA+Q3JlYXppb25lIFNpdGkgV2ViPC9hPjwvZGl2Pg==';
    echo base64_decode($swc);?>  </div>
          </div>

    ET VOICI le JS :
    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
    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
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
     
    /*
    ---
     
    script: slideGallery.js
     
    description: Multifunctional gallery for MooTools
     
    license: MIT-style license
     
    authors:
    - Sergii Kashcheiev
     
    requires:
    - core/1.3: Options
    - core/1.3: Events
    - core/1.3: Fx.Tween
    - core/1.3: Fx.Transitions
     
    provides: [slideGallery, fadeGallery]
     
    ...
    */
    var slideGallery = new Class({
    	Version: "1.3.1",
    	Implements: [Options, Events],
    	options: {
    		holder: ".jea_holder_swc",
    		elementsParent: "ul",
    		elements: "li",
    		nextItem: ".jea_slide_swc_next",
    		prevItem: ".jea_slide_swc_prev",
    		stop: ".stop",
    		start: ".start",
    		speed: 600,
    		duration: 4000,
    		steps: 1,
    		current: 0,
    		transition: "sine:in:out",
    		direction: "Vertical",
    		mode: "callback",
    		currentClass: "current",
    		nextDisableClass: "next-disable",
    		prevDisableClass: "prev-disable",
    		paging: false,
    		pagingEvent: "click",
    		pagingHolder: ".paging",
    		random: false,
    		autoplay: false,
    		autoplayOpposite: false,
    		stopOnHover: true
    		/* 
    		onStart: $empty,
    		onPlay: $empty,
    		*/ 
    	},
    	initialize: function(gallery, options) {
    		if(gallery.length == null) this.gallery = gallery;
    		else this.gallery = gallery[0];
    		if(!this.gallery) return false;
    		this.setOptions(options);
    		this.holder = this.gallery.getElement(this.options.holder);
    		this.itemsParent = this.holder.getElement(this.options.elementsParent);
    		this.items = this.itemsParent.getElements(this.options.elements);
    		this.next = this.gallery.getElement(this.options.nextItem);
    		this.prev = this.gallery.getElement(this.options.prevItem);
    		this.stop = this.gallery.getElement(this.options.stop);
    		this.start = this.gallery.getElement(this.options.start);
    		this.current = this.options.current;
    		this.bound = {rotate: this.rotate.bind(this) }
     
    		if(this.options.direction == "Vertical") {
    			this.direction = "margin-top";
    			this.size = this.items[0].getHeight();
    			this.visible = Math.round(this.holder.getHeight()/this.size);
    		}
    		else {
    			this.direction = "margin-left";
    			this.size = this.items[0].getWidth();
    			this.visible = Math.round(this.holder.getWidth()/this.size);
    		}
     
    		if(this.items.length <= this.visible) {
    			if(this.next) this.next.addClass(this.options.nextDisableClass).addEvent("click", function() {return false;});
    			if(this.prev) this.prev.addClass(this.options.prevDisableClass).addEvent("click", function() {return false;});
    			if(this.stop) this.stop.addEvent("click", function() {return false;});
    			if(this.start) this.start.addEvent("click", function() {return false;});
    			this.gallery.addClass("stopped no-active");
    			this.fireEvent("start", this.current, this.visible, this.items.length, this.items[this.current]);
    			return false;
    		}
     
    		this.options.steps = this.options.steps > this.visible ? this.visible : this.options.steps;
    		this.options.duration = this.options.duration < 1000 ? 1000 : this.options.duration;
    		this.options.speed = this.options.speed > 6000 ? 6000 : this.options.speed;
    		if(this.options.speed > this.options.duration) this.options.speed = this.options.duration;
     
    		this.fx = new Fx.Tween(this.itemsParent, {
    			property: this.direction,
    			duration: this.options.speed,
    			transition: this.options.transition,
    			link: "cancel",
    			fps: 100,
    			onCancel: function() {
    				if(!this.callChain()) this.fireEvent("chainComplete", this.subject);
    				return this;
    			}
    		});
     
    		if(this.options.random) this.shuffle();
    		this.getInitialCurrent();
     
    		if(this.options.mode == "circle") {
    			while(this.items.length < this.options.steps+this.visible) {
    				this.itemsParent.innerHTML += this.itemsParent.innerHTML;
    				this.items = this.itemsParent.getElements(this.options.elements);
    			}
    			for(var i=0; i<this.current; i++) {
    				this.items[i].inject(this.itemsParent, "bottom");
    			}
    			this.options.paging = false;
    		}
    		else {
    			if(this.options.paging) this.createPaging();
    			this.play(false);
    		}
     
    		if(this.next) {
    			this.next.addEvent("click", function() {
    				this.nextSlide();
    				return false;
    			}.bind(this));
    		}
     
    		if(this.prev) {
    			this.prev.addEvent("click", function() {
    				this.prevSlide();
    				return false;
    			}.bind(this));
    		}
     
    		if(this.options.autoplay || this.options.autoplayOpposite) this.timer = this.bound.rotate.delay(this.options.duration);
    		else this.gallery.addClass("stopped");
     
    		if(this.start) {
    			this.start.addEvent("click", function() {
    				clearTimeout(this.timer);
    				this.gallery.removeClass("stopped");
    				this.timer = this.bound.rotate.delay(this.options.duration);
    				return false;
    			}.bind(this));
    		}
     
    		if(this.stop) {
    			this.stop.addEvent("click", function() {
    				this.gallery.addClass("stopped");
    				clearTimeout(this.timer);
    				return false;
    			}.bind(this));
    		}
     
    		if(this.options.stopOnHover) {
    			this.gallery.addEvent("mouseenter", function() {
    				clearTimeout(this.timer);
    			}.bind(this));
    			this.gallery.addEvent("mouseleave", function() {
    				if(!this.gallery.hasClass("stopped")) {
    					clearTimeout(this.timer);
    					this.timer = this.bound.rotate.delay(this.options.duration);
    				}
    			}.bind(this));
    		}
     
    		this.fireEvent("start", this.current, this.visible, this.items.length, this.items[this.current]);
    	},
    	getInitialCurrent: function() {
    		var tempCurrent = this.items.get("class").indexOf(this.options.currentClass);
    		if(tempCurrent != -1) this.current = tempCurrent;
    		else {
    			if(this.current > this.items.length-1) this.current = this.items.length-1;
    			else	if(this.current < 0) this.current = 0;
    		}
    		if(this.options.mode != "circle" && this.visible+this.current >= this.items.length) this.current = this.items.length-this.visible;
    		return this;
    	},
    	rotate: function() {
    		if(!this.options.autoplayOpposite) this.nextSlide();
    		else this.prevSlide();
    		this.timer = this.bound.rotate.delay(this.options.duration);
    		return this;
    	},
    	play: function(animate) {
    		if(this.options.mode == "line") this.sidesChecking();
    		if(animate) this.fx.start(-this.current*this.size);
    		else this.fx.set(-this.current*this.size);
    		if(this.options.paging) this.setActivePage();
    		this.fireEvent("play", this.current, this.visible, this.items.length, this.items[this.current]);
    		return this;
    	},
    	nextSlide: function() {
    		if(this.options.mode != "circle") {
    			if(this.visible+this.current >= this.items.length) {
    				if(this.options.mode == "callback") this.current = 0;
    			}
    			else if(this.visible+this.current+this.options.steps >= this.items.length) {
    				this.current = this.items.length-this.visible;
    			}
    			else this.current += this.options.steps;
    			this.play(true);
    		}
    		else {
    			var temp = this.current;
    			if((this.current += this.options.steps) >= this.items.length) this.current -= this.items.length;
    			this.fx.start(-this.size*this.options.steps).chain(function() {
    				for(var i=0; i<this.options.steps; i++) {
    					if(temp >= this.items.length) temp = 0;
    					this.items[temp++].inject(this.itemsParent, "bottom");
    				}
    				this.fx.set(0);
    			}.bind(this));
    			this.fireEvent("play", this.current, this.visible, this.items.length, this.items[this.current]);
    		}
    		return this;
    	},
    	prevSlide: function() {
    		if(this.options.mode != "circle") {
    			if(this.current <= 0) {
    				if(this.options.mode == "callback") this.current = this.items.length-this.visible;
    			}
    			else if(this.current-this.options.steps <= 0) {
    				this.current = 0;
    			}
    			else	this.current -= this.options.steps;
    			this.play(true);
    		}
    		else {
    			for(var i=0; i<this.options.steps; i++) {
    				if(this.current-1 < 0) this.current = this.items.length;
    				this.items[--this.current].inject(this.itemsParent, "top");
    			}
    			this.fx.set(-this.size*this.options.steps).start(0);
    			this.fireEvent("play", this.current, this.visible, this.items.length, this.items[this.current]);
    		}
    		return this;
    	},
    	sidesChecking: function() {
    		this.next.removeClass(this.options.nextDisableClass);
    		this.prev.removeClass(this.options.prevDisableClass);
    		if(this.visible+this.current >= this.items.length) this.next.addClass(this.options.nextDisableClass)
    		else if(this.current==0) this.prev.addClass(this.options.prevDisableClass);
    		return this;
    	},
    	createPaging: function() {
    		this.paging = new Element("ul");
    		var pagingHold = this.gallery.getElement(this.options.pagingHolder);
    		if(pagingHold != null) this.paging.inject(pagingHold);
    		else this.paging.inject(this.gallery).addClass("paging");
     
    		var length = Math.ceil((this.items.length-this.visible)/this.options.steps)+1;
    		var str = "";
    		for(var i=0; i<length; i++) {
    			str += '<li><a href="#">' + parseInt(i+1) + '</a></li>';
    		}
    		this.paging = this.paging.set("html", str).getElements("a");
    		this.paging.each(function(el, i) {
    			el.addEvent(this.options.pagingEvent, function() {
    				if(i < length-1) this.current = i*this.options.steps;
    				else this.current = this.items.length-this.visible;
    				this.play(true);
    				return false;
    			}.bind(this));
    		}.bind(this));
    		return this;
    	},
    	setActivePage: function() {
    		this.paging.removeClass("active")[Math.ceil(this.current/this.options.steps)].addClass("active");
    		return this;
    	},
    	shuffle: function() {
    		var str = "";
    		this.items.sort(function(){return 0.5 - Math.random()}).each(function(el) {
    			str += new Element("div").adopt(el).get("html");
    		});
    		this.items = this.itemsParent.set("html", str).getElements(this.options.elements);
    		return this;
    	}
    });
    var fadeGallery = new Class({
    	Extends: slideGallery,
    	initialize: function(gallery, options) {
    		if(options.mode == "circle") options.mode = "callback";
    		this.parent(gallery, options);
    		this.fxFade = [];
    		this.items.each(function(el, i) {
    			this.fxFade[i] = new Fx.Tween(el, {
    				property: "opacity",
    				duration: this.options.speed,
    				transition: this.options.transition,
    				link: "cancel"
    			});
    			this.fxFade[i].set(0);
    		}.bind(this));
    		this.play(false);
    	},
    	play: function(animate) {
    		if(this.previous == null) {
    			this.previous = 0;
    			return false;
    		}
    		if(this.options.mode == "line") this.sidesChecking();
    		if(animate) {
    			this.fxFade[this.previous].start(0);
    			this.fxFade[this.current].start(1);
    		}
    		else {
    			this.fxFade[this.previous].set(0);
    			this.fxFade[this.current].set(1);
    		}
    		this.previous = this.current;
    		if(this.options.paging) this.setActivePage();
    		this.fireEvent("play", this.current, this.visible, this.items.length, this.items[this.current]);
    	}
    });

  2. #2
    Expert éminent

    Avatar de vermine
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    6 582
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2008
    Messages : 6 582
    Par défaut
    Bonjour,

    Qu'entendez-vous par "de façon très aléatoire" ?
    Nous aurions plus facile à simuler le cas en ayant le code HTML généré et non le code PHP.

Discussions similaires

  1. Forcer scroll vertical en empechant scroll horizontal
    Par calitom dans le forum Mise en page CSS
    Réponses: 5
    Dernier message: 07/11/2011, 10h39
  2. table virtuel : fill horizontal mais pas vertical
    Par elekis dans le forum SWT/JFace
    Réponses: 2
    Dernier message: 02/02/2010, 13h01
  3. Un menu vertical à la manière d'un menu horizontal
    Par Ravaka dans le forum Mise en page CSS
    Réponses: 1
    Dernier message: 21/01/2007, 12h25
  4. Colonne horizontal vers vertical
    Par rvzip64 dans le forum Requêtes
    Réponses: 10
    Dernier message: 21/08/2006, 08h45
  5. scrolling vertical et horizontal
    Par myriam dans le forum MFC
    Réponses: 2
    Dernier message: 24/01/2003, 17h06

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