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 :

Image fullcreen scrollable


Sujet :

jQuery

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Candidat au Club
    Homme Profil pro
    Analyste d'exploitation
    Inscrit en
    Avril 2013
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Analyste d'exploitation
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Avril 2013
    Messages : 3
    Par défaut Image fullcreen scrollable
    Bonjour à tous,

    Je débute dans la programmation html / js & j'ai découvert récemment le projet Sideways (ici) que je désirais adapter à mes besoins. Je me suis plongé dans le code pour faire les modifications que je voulais me je me suis heurté à un problème qui surpasse mes connaissances.

    Après avoir remplacé les images présentes dans la démo ( par les miennes, et être passé en mode "full", je m'apercois que mes images sont tronqués (car trop hautes, pas comme les images en mode paysage de la demo). Le tronquage ne me dérange pas en lui même mais je souhaite pouvoir "scroller" de haut en bas.

    J'aimerais en fait pouvoir scroller sur les images fullscreen comme on peut le faire sur ce site.

    J'ai essayé de bidouiller le script avec des:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    makeScrollable();
     
    function makeScrollable(){
    		$("div.bg").bind('mousemove',function(e){
    		var top = (e.pageY - $("div.bg").scrollTop()/2) ;
    		$("div.bg").scrollTop(top);
            });
    }
    mais je n'arrive pas à trouver le bon lien (on appelle ça comment?) après le $.

    Désolé si je ne suis pas très compréhensible, je débute vraiment

    Merci d'avance!

    Bonne soirée,

    DieseOne

  2. #2
    Membre Expert Avatar de Lorenzo77
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 472
    Détails du profil
    Informations personnelles :
    Âge : 53
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 472
    Par défaut
    salut,

    tu parles du sélecteur ?
    celui qui est entre '' : $('XXXXX') le XXXXX ?

    div.bg = selection des DIV ayant comme class BG, en HTML ca donne ca :

  3. #3
    Candidat au Club
    Homme Profil pro
    Analyste d'exploitation
    Inscrit en
    Avril 2013
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Analyste d'exploitation
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Avril 2013
    Messages : 3
    Par défaut
    Salut Lorenzo!

    Hum non je ne parlais pas du sélecteur, mais c'est vrai que sans le code entier, tu ne pouvais pas vraiment comprendre, alors le voici

    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
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
     
    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>La couleur de mes rêves</title>
    <style type="text/css">
    <!--
    html,body{height:100%}
    body {margin:0; padding:0; background:#333 url(sw_page_bg.png); overflow:hidden; font-family:Helvetica, Arial, sans-serif; font-size:16px;}
    /* custom fonts */
    @font-face {
    	font-family: 'eurof55-webfont';
    	src: url('fonts/eurof55-webfont.eot');
    	src: local('☺'), url('fonts/eurof55-webfont.woff') format('woff'), url('fonts/eurof55-webfont.ttf') format('truetype'), url('fonts/eurof55-webfont.svg#webfont8xigBfG2') format('svg');
    }
    @font-face {
    	font-family: 'eurof35-webfont';
    	src: url('fonts/eurof35-webfont.eot');
    	src: local('☺'), url('fonts/eurof35-webfont.woff') format('woff'), url('fonts/eurof35-webfont.ttf') format('truetype'), url('fonts/eurof35-webfont.svg#webfont8xigBfG2') format('svg');
    }
    @font-face {
    	font-family: 'graublauweb-webfont';
    	src: url('fonts/graublauweb-webfont.eot');
    	src: local('☺'), url('fonts/graublauweb-webfont.woff') format('woff'), url('fonts/graublauweb-webfont.ttf') format('truetype'), url('fonts/graublauweb-webfont.svg#webfont8xigBfG2') format('svg');
    }
    .clear{clear:both;}
    a:link,a:visited,a:hover{color:#ddd;}
    a:hover{color:#fff; text-decoration:none;}
    #bg{position:fixed; left:585px; top:0; width:100%; height:100%;}
    #bgimg{display:none; cursor:pointer; -ms-interpolation-mode: bicubic;} /* special IE fix for resized images */
    #preloader{position:absolute; z-index:2; width:140px; padding:20px; top:20px; left:50px; background:#000; color:#666; font-family:graublauweb-webfont, Helvetica, Arial, sans-serif; font-size:16px; -moz-border-radius:5px; -khtml-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
    #preloader img{margin-right:20px;}
    #toolbar{display:inline-block; padding:4px 15px; margin:20px 15px; background:#262626 url(sw_btn_bg.png) repeat-x; -moz-border-radius:8px; -khtml-border-radius:8px; -webkit-border-radius:8px; border-radius:8px; font-family:graublauweb-webfont, Helvetica, Arial, sans-serif; font-size:12px; color:#fff; cursor:pointer;}
    #outer_container{position:relative; margin:0; width:700px; padding:0 100px 0 0; z-index:2; background:url(empty.gif);} /* fucking IE needs a background value to understand hover area */
    #customScrollBox{position:relative; overflow:hidden; background:url(sw_l_bg.png) repeat-y;}
    #customScrollBox .container{position:relative; width:585px; top:0; float:left;}
    #customScrollBox .content{clear:both;}
    #customScrollBox .content h1{padding:5px; margin:10px; color:#fff; font-family:eurof55-webfont, Helvetica, Arial, sans-serif; font-size:48px;}
    #customScrollBox .content h2{padding:5px; margin:10px 10px 0 10px; color:#fff; font-family:eurof35-webfont, Helvetica, Arial, sans-serif; font-size:24px;}
    #customScrollBox .content p{padding:5px; margin:0 10px 10px 10px; color:#ddd; font-family:graublauweb-webfont, Helvetica, Arial, sans-serif; line-height:26px;}
    .light{font-family:eurof35-webfont, Helvetica, Arial, sans-serif;}
    .grey{color:#999;}
    .lightgrey{color:#ddd;}
    .s36{font-size:36px;}
    .s24{font-size:24px;}
    #customScrollBox a.thumb_link{position:relative; margin:0 0 1px 1px; display:block; float:left;}
    #customScrollBox img{border:none;}
    #customScrollBox a.thumb_link .selected{position:absolute; top:0; left:0; width:145px; height:91px; background:url(sw_thumb_selected.png) no-repeat; display:none;}
    #dragger_container{position:relative; width:30px; height:580px; float:left; margin:10px 0 0 0; background:url(sw_dragger_bg.png) repeat-y center;}
    #dragger{position:absolute; width:30px; height:59px; background:url(round_custom_scrollbar_bg.png) no-repeat center center; cursor:pointer;}
    #arrow_indicator{position:absolute; z-index:1; width:50px; padding:10px; top:50%; margin-top:-25px; left:20px; background:url(sw_transparent_black_bg.png); -moz-border-radius:5px; -khtml-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; display:none;}
    #nextimage_tip{position:fixed; z-index:1; padding:0 20px; line-height:40px; color:#fff; height:40px; top:50%; margin-top:-20px; right:20px; background:url(sw_transparent_black_bg.png); -moz-border-radius:5px; -khtml-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; display:none; font-family:graublauweb-webfont, Helvetica, Arial, sans-serif;}
    .with_border{border:1px solid #000;}
    .with_shadow{-moz-box-shadow:0 0 40px #000; -webkit-box-shadow:0 0 40px #000; box-shadow:0 0 40px #000;}
    -->
    </style>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <script type="text/javascript" src="jquery.easing.1.3.js"></script>
    <script type="text/javascript" src="jquery.mousewheel.min.js"></script>
    </head>
     
    <body>
    <div id="outer_container">
    <div id="customScrollBox">
    	<div class="container">
        	<div class="content">
            	<h1>LA COULEUR DE MES<span class="lightgrey"> REVES</span> <br /><span class="light"><span class="grey"><span class="s36">Thomas Vauthier</span></span></span></h1>
                <p>Mon projet vise à recréer un espace virtuel, grâce au numérique, analogue à celui des rêves. </p>
                <div id="toolbar"></div><div class="clear"></div>
                <a href="imgs/mine/1.jpg" class="thumb_link"><span class="selected"></span><img src="imgs/mine/1_thumb.jpg" title="Escalier psyché" alt="Escalier psyché" class="thumb" /></a>
                <a href="imgs/mine/2.jpg" class="thumb_link"><span class="selected"></span><img src="imgs/mine/2_thumb.jpg" title="Escalier psyché" alt="Escalier psyché" class="thumb" /></a>
                <a href="imgs/mine/3.jpg" class="thumb_link"><span class="selected"></span><img src="imgs/mine/3_thumb.jpg" title="Escalier psyché" alt="Escalier psyché" class="thumb" /></a>
                <a href="imgs/mine/4.jpg" class="thumb_link"><span class="selected"></span><img src="imgs/mine/4_thumb.jpg" title="Escalier psyché" alt="Escalier psyché" class="thumb" /></a>
                <a href="imgs/mine/5.jpg" class="thumb_link"><span class="selected"></span><img src="imgs/mine/5_thumb.jpg" title="Escalier psyché" alt="Escalier psyché" class="thumb" /></a>
                <a href="imgs/mine/6.jpg" class="thumb_link"><span class="selected"></span><img src="imgs/mine/6_thumb.jpg" title="Escalier psyché" alt="Escalier psyché" class="thumb" /></a>
                <a href="imgs/mine/7.jpg" class="thumb_link"><span class="selected"></span><img src="imgs/mine/7_thumb.jpg" title="Escalier psyché" alt="Escalier psyché" class="thumb" /></a>
     
                <p class="clear"></p>
     
            </div>
    	</div>
        <div id="dragger_container"><div id="dragger"></div></div>
    </div>
    </div>
    <div id="bg"> 
        <img src="imgs/mine/0.jpg" title="Escalier d'acceuil" id="bgimg" />
    	<div id="preloader"><img src="ajax-loader_dark.gif" width="32" height="32" align="absmiddle" />LOADING...</div>
        <div id="arrow_indicator"><img src="sw_arrow_indicator.png" width="50" height="50"  /></div>
        <div id="nextimage_tip">Click for next image</div>
    </div>
    <script>
    	//set default view mode
    	$defaultViewMode="fit"; //full (fullscreen background), fit (fit to window), original (no scale)
    	//cache vars
    	$bg=$("#bg");
    	$bgimg=$("#bg #bgimg");
    	$preloader=$("#preloader");
    	$outer_container=$("#outer_container");
    	$outer_container_a=$("#outer_container a.thumb_link");
    	$toolbar=$("#toolbar");
    	$nextimage_tip=$("#nextimage_tip");
     
    $(window).load(function() {
    	$toolbar.data("imageViewMode",$defaultViewMode); //default view mode
    	ImageViewMode($toolbar.data("imageViewMode"));
    	//cache vars
    	$customScrollBox=$("#customScrollBox");
    	$customScrollBox_container=$("#customScrollBox .container");
    	$customScrollBox_content=$("#customScrollBox .content");
    	$dragger_container=$("#dragger_container");
    	$dragger=$("#dragger");
     
     
    	CustomScroller();
     
    	function CustomScroller(){
    		outerMargin=0;
    		innerMargin=20;
    		$customScrollBox.height($(window).height()-outerMargin);
    		$dragger_container.height($(window).height()-innerMargin);
    		visibleHeight=$(window).height()-outerMargin;
    		if($customScrollBox_container.height()>visibleHeight){ //custom scroll depends on content height
    			$dragger_container,$dragger.css("display","block");
    			totalContent=$customScrollBox_content.height();
    			draggerContainerHeight=$(window).height()-innerMargin;
    			animSpeed=400; //animation speed
    			easeType="easeOutCirc"; //easing type
    			bottomSpace=1.05; //bottom scrolling space
    			targY=0;
    			draggerHeight=$dragger.height();
    			$dragger.draggable({ 
    				axis: "y", 
    				containment: "parent", 
    				drag: function(event, ui) {
    					Scroll();
    				}, 
    				stop: function(event, ui) {
    					DraggerOut();
    				}
    			});
     
    			//scrollbar click
    			$dragger_container.click(function(e) {
    				var mouseCoord=(e.pageY - $(this).offset().top);
    				var targetPos=mouseCoord+$dragger.height();
    				if(targetPos<draggerContainerHeight){
    					$dragger.css("top",mouseCoord);
    					Scroll();
    				} else {
    					$dragger.css("top",draggerContainerHeight-$dragger.height());
    					Scroll();
    				}
    			});
     
    			//mousewheel
    			$(function($) {
    				$customScrollBox.bind("mousewheel", function(event, delta) {
    					vel = Math.abs(delta*10);
    					$dragger.css("top", $dragger.position().top-(delta*vel));
    					Scroll();
    					if($dragger.position().top<0){
    						$dragger.css("top", 0);
    						$customScrollBox_container.stop();
    						Scroll();
    					}
    					if($dragger.position().top>draggerContainerHeight-$dragger.height()){
    						$dragger.css("top", draggerContainerHeight-$dragger.height());
    						$customScrollBox_container.stop();
    						Scroll();
    					}
    					return false;
    				});
    			});
     
    			function Scroll(){
    				var scrollAmount=(totalContent-(visibleHeight/bottomSpace))/(draggerContainerHeight-draggerHeight);
    				var draggerY=$dragger.position().top;
    				targY=-draggerY*scrollAmount;
    				var thePos=$customScrollBox_container.position().top-targY;
    				$customScrollBox_container.stop().animate({top: "-="+thePos}, animSpeed, easeType); //with easing
    			}
     
    			//dragger hover
    			$dragger.mouseup(function(){
    				DraggerOut();
    			}).mousedown(function(){
    				DraggerOver();
    			});
     
    			function DraggerOver(){
    				$dragger.css("background", "url(round_custom_scrollbar_bg_over.png)");
    			}
     
    			function DraggerOut(){
    				$dragger.css("background", "url(round_custom_scrollbar_bg.png)");
    			}
    		} else { //hide custom scrollbar if content is short
    			$dragger,$dragger_container.css("display","none");
    		}
    	}
     
    	//resize browser window functions
    	$(window).resize(function() {
    		FullScreenBackground("#bgimg"); //scale bg image
    		$dragger.css("top",0); //reset content scroll
    		$customScrollBox_container.css("top",0);
    		$customScrollBox.unbind("mousewheel");
    		CustomScroller();
    	});
     
    	LargeImageLoad($bgimg);
    });
     
    	//loading bg image
    	$bgimg.load(function() {
    		LargeImageLoad($(this));
    	});
     
    	function LargeImageLoad($this){
    		$preloader.fadeOut("fast"); //hide preloader
    		$this.removeAttr("width").removeAttr("height").css({ width: "", height: "" }); //lose all previous dimensions in order to rescale new image data
    		$bg.data("originalImageWidth",$this.width()).data("originalImageHeight",$this.height());
    		if($bg.data("newTitle")){
    			$this.attr("title",$bg.data("newTitle")); //set new image title attribute
    		}
    		FullScreenBackground($this); //scale new image
    		$bg.data("nextImage",$($outer_container.data("selectedThumb")).next().attr("href")); //get and store next image
    		if(typeof itemIndex!="undefined"){
    			if(itemIndex==lastItemIndex){ //check if it is the last image
    				$bg.data("lastImageReached","Y");
    				$bg.data("nextImage",$outer_container_a.first().attr("href")); //get and store next image
    			} else {
    				$bg.data("lastImageReached","N");
    			}
    		} else {
    			$bg.data("lastImageReached","N");
    		}
    		$this.fadeIn("slow"); //fadein background image
    		if($bg.data("nextImage") || $bg.data("lastImageReached")=="Y"){ //don't close thumbs pane on 1st load
    			SlidePanels("close"); //close the left pane
    		}
    		NextImageTip();
    	}
     
    	//slide in/out left pane
    	$outer_container.hover(
    		function(){ //mouse over
    			SlidePanels("open");
    		},
    		function(){ //mouse out
    			SlidePanels("close");
    		}
    	);
     
    	//Clicking on thumbnail changes the background image
    	$outer_container_a.click(function(event){
    		event.preventDefault();
    		var $this=this;
    		$bgimg.css("display","none");
    		$preloader.fadeIn("fast"); //show preloader
    		//style clicked thumbnail
    		$outer_container_a.each(function() {
        		$(this).children(".selected").css("display","none");
      		});
    		$(this).children(".selected").css("display","block");
    		//get and store next image and selected thumb 
    		$outer_container.data("selectedThumb",$this); 
    		$bg.data("nextImage",$(this).next().attr("href")); 	
    		$bg.data("newTitle",$(this).children("img").attr("title")); //get and store new image title attribute
    		itemIndex=getIndex($this); //get clicked item index
    		lastItemIndex=($outer_container_a.length)-1; //get last item index
    		$bgimg.attr("src", "").attr("src", $this); //switch image
    	}); 
     
    	//clicking on large image loads the next one
    	$bgimg.click(function(event){
    		var $this=$(this);
    		if($bg.data("nextImage")){ //if next image data is stored
    			$this.css("display","none");
    			$preloader.fadeIn("fast"); //show preloader
    			$($outer_container.data("selectedThumb")).children(".selected").css("display","none"); //deselect thumb
    			if($bg.data("lastImageReached")!="Y"){
    				$($outer_container.data("selectedThumb")).next().children(".selected").css("display","block"); //select new thumb
    			} else {
    				$outer_container_a.first().children(".selected").css("display","block"); //select new thumb - first
    			}
    			//store new selected thumb
    			var selThumb=$outer_container.data("selectedThumb");
    			if($bg.data("lastImageReached")!="Y"){
    				$outer_container.data("selectedThumb",$(selThumb).next()); 
    			} else {
    				$outer_container.data("selectedThumb",$outer_container_a.first()); 
    			}
    			$bg.data("newTitle",$($outer_container.data("selectedThumb")).children("img").attr("title")); //get and store new image title attribute
    			if($bg.data("lastImageReached")!="Y"){
    				itemIndex++;
    			} else {
    				itemIndex=0;
    			}
    			$this.attr("src", "").attr("src", $bg.data("nextImage")); //switch image
    		}
    	});
     
    	//function to get element index (fuck you IE!)
    	function getIndex(theItem){
    		for ( var i = 0, length = $outer_container_a.length; i < length; i++ ) {
    			if ( $outer_container_a[i] === theItem ) {
    				return i;
    			}
    		}
    	}
     
    	//toolbar (image view mode button) hover
    	$toolbar.hover(
    		function(){ //mouse over
    			$(this).stop().fadeTo("fast",1);
    		},
    		function(){ //mouse out
    			$(this).stop().fadeTo("fast",0.8);
    		}
    	); 
    	$toolbar.stop().fadeTo("fast",0.8); //set its original state
     
    	//Clicking on toolbar changes the image view mode
    	$toolbar.click(function(event){
    		if($toolbar.data("imageViewMode")=="full"){
    			ImageViewMode("fit");
    		} else if($toolbar.data("imageViewMode")=="fit") {
    			ImageViewMode("original");
    		} else if($toolbar.data("imageViewMode")=="original"){
    			ImageViewMode("full");
    		}
    	});
     
    	//next image balloon tip
    	function NextImageTip(){
    		if($bg.data("nextImage")){ //check if this is the first image
    			$nextimage_tip.stop().css("right",20).fadeIn("fast").fadeOut(2000,"easeInExpo",function(){$nextimage_tip.css("right",$(window).width());});
    		}
    	}
     
    	//slide in/out left pane function
    	function SlidePanels(action){
    		var speed=900;
    		var easing="easeInOutExpo";
    		if(action=="open"){
    			$("#arrow_indicator").fadeTo("fast",0);
    			$outer_container.stop().animate({left: 0}, speed,easing);
    			$bg.stop().animate({left: 585}, speed,easing);
    		} else {
    			$outer_container.stop().animate({left: -710}, speed,easing);
    			$bg.stop().animate({left: 0}, speed,easing,function(){$("#arrow_indicator").fadeTo("fast",1);});
    		}
    	}
     
    //Image scale function
    function FullScreenBackground(theItem){
     
    	var winWidth=$(window).width();
    	var winHeight=$(window).height();
    	var imageWidth=$(theItem).width();
    	var imageHeight=$(theItem).height();
     
     
    	if($toolbar.data("imageViewMode")!="original"){ //scale
    		$(theItem).removeClass("with_border").removeClass("with_shadow"); //remove extra styles of orininal view mode
    		var picHeight = imageHeight / imageWidth;
    		var picWidth = imageWidth / imageHeight;
     
     
    		if($toolbar.data("imageViewMode")!="fit"){ //image view mode: full
    			if ((winHeight / winWidth) < picHeight) {
    				$(theItem).css("width",winWidth).css("height",picHeight*winWidth);
     
     
    			} else {
    				$(theItem).css("height",winHeight).css("width",picWidth*winHeight);
     
     
     
    			};
     
     
    		} else { //image view mode: fit
    			if ((winHeight / winWidth) > picHeight) {
    				$(theItem).css("width",winWidth).css("height",picHeight*winWidth);
    			} else {
    				$(theItem).css("height",winHeight).css("width",picWidth*winHeight);
    			};
    		}
    		//center it
    		$(theItem).css("margin-left",((winWidth - $(theItem).width())/2)).css("margin-top",((winHeight - $(theItem).height())/2));
    	} else { //no scale
    		//add extra styles for orininal view mode
    		$(theItem).addClass("with_border").addClass("with_shadow");
    		//set original dimensions
    		$(theItem).css("width",$bg.data("originalImageWidth")).css("height",$bg.data("originalImageHeight"));
    		//center it
    		$(theItem).css("margin-left",((winWidth-$(theItem).outerWidth())/2)).css("margin-top",((winHeight-$(theItem).outerHeight())/2));
    	}
    }
     
     
    makeScrollable();
     
    function makeScrollable(){
    		$("div.bg").bind('mousemove',function(e){
    		var top = (e.pageY - $("div.bg").scrollTop()/2) ;
    		$("div.bg").scrollTop(top);
            });
    }
     
     
    //image view mode function - full or fit
    function ImageViewMode(theMode){
    	$toolbar.data("imageViewMode", theMode); //store new mode
    	FullScreenBackground($bgimg); //scale bg image
    	//re-style button
    	if(theMode=="full"){
    		$toolbar.html("<span class='lightgrey'>IMAGE VIEW MODE &rsaquo;</span> FULL");
    	} else if(theMode=="fit") {
    		$toolbar.html("<span class='lightgrey'>IMAGE VIEW MODE &rsaquo;</span> FIT");
    	} else {
    		$toolbar.html("<span class='lightgrey'>IMAGE VIEW MODE &rsaquo;</span> ORIGINAL");
    	}
    }
     
    //preload script images
    var images=["ajax-loader_dark.gif","round_custom_scrollbar_bg_over.png"];
    $.each(images, function(i) {
      images[i] = new Image();
      images[i].src = this;
    });
     
     
    </script>
    </body>
    </html>
    J'aimerais que les photos affichés en mode "full" (et normal également) soit "scrollabre" (scroll), qu'on puisse se déplacer de bas en haut sur la page, aurais tu une idée?

    J'ai mis mon site en ligne pour que vous puissiez voir le problème: http://www.snooze.fr/site.html

    Merci d'avance!!

  4. #4
    Membre Expert Avatar de Lorenzo77
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 472
    Détails du profil
    Informations personnelles :
    Âge : 53
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 472
    Par défaut
    vu la taille du code ca va etre dur de te donner la bonne réponse...tu pourrais :
    -utiliser un plugin pour JQ, ex : http://logicbox.net/jquery/simplyscroll/vertical.html
    -tout simplement réduire la taille des images a la zone dispo pour l'affichage

  5. #5
    Candidat au Club
    Homme Profil pro
    Analyste d'exploitation
    Inscrit en
    Avril 2013
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Analyste d'exploitation
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Avril 2013
    Messages : 3
    Par défaut
    Ok merci je vais regarder ça!

    Si quelqu'un a une autre idée en passant

Discussions similaires

  1. Déplacement d'image dans un scrollable panel
    Par Peck777 dans le forum Windows Forms
    Réponses: 1
    Dernier message: 17/04/2009, 12h36
  2. Resize d'une image
    Par Anonymous dans le forum C
    Réponses: 6
    Dernier message: 13/07/2008, 22h23
  3. MAJ Image dans Scrollable Picture
    Par psal78 dans le forum AWT/Swing
    Réponses: 3
    Dernier message: 20/06/2007, 14h19
  4. grande image dynamique scrollable
    Par TabrisLeFol dans le forum AWT/Swing
    Réponses: 5
    Dernier message: 17/11/2006, 17h27
  5. lire une image au format RAW
    Par Anonymous dans le forum OpenGL
    Réponses: 5
    Dernier message: 20/05/2002, 00h11

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