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
|
<div id="pg_preview">
<img class="pg_thumb" style="display:block;z-index:9999;" src="images/medium/1.jpg" alt="images/large/1.jpg"/>
<img class="pg_thumb" src="images/medium/2.jpg" alt="images/large/2.jpg"/>
<img class="pg_thumb" src="images/medium/3.jpg" alt="images/large/3.jpg"/>
<img class="pg_thumb" src="images/medium/4.jpg" alt="images/large/4.jpg"/>
<img class="pg_thumb" src="images/medium/5.jpg" alt="images/large/5.jpg"/>
<img class="pg_thumb" src="images/medium/6.jpg" alt="images/large/6.jpg"/>
<img class="pg_thumb" src="images/medium/7.jpg" alt="images/large/7.jpg"/>
<img class="pg_thumb" src="images/medium/8.jpg" alt="images/large/8.jpg"/>
</div>
<div id="pg_desc1" class="pg_description">
<div style="display:block;left:250px;">
<h2>Project Description</h2>
<p>A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame.</p>
</div>
<div>
<h2>Project Description</h2>
<p>It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer.</p>
</div>
<div>
<h2>Project Description</h2>
<p> Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p>
</div>
<div>
<h2>Project Description</h2>
<p>A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame.</p>
</div>
<div>
<h2>Project Description</h2>
<p>The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didnt listen. She packed her seven versalia, put her initial into the belt and made herself on the way.</p>
</div>
<div>
<h2>Project Description</h2>
<p>It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer.</p>
</div>
<div>
<h2>Project Description</h2>
<p> Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p>
</div>
<div>
<h2>Project Description</h2>
<p>A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame.</p>
</div>
</div>
<div id="pg_desc2" class="pg_description">
<div style="display:block;left:250px;">
<h2>Technologies Used</h2>
<p>The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didnt listen. She packed her seven versalia, put her initial into the belt and made herself on the way.</p>
</div>
<div>
<h2>Technologies Used</h2>
<p>A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.</p>
</div>
<div>
<h2>Technologies Used</h2>
<p>It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls.</p>
</div>
<div>
<h2>Technologies Used</h2>
<p>The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didnt listen. She packed her seven versalia, put her initial into the belt and made herself on the way.</p>
</div>
<div>
<h2>Technologies Used</h2>
<p>A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.</p>
</div>
<div>
<h2>Technologies Used</h2>
<p>It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls.</p>
</div>
<div>
<h2>Technologies Used</h2>
<p>The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didnt listen. She packed her seven versalia, put her initial into the belt and made herself on the way.</p>
</div>
<div>
<h2>Technologies Used</h2>
<p>A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.</p>
</div>
</div>
</div>
<div id="thumbContainter">
<div id="thumbScroller">
<div class="container">
<div class="content">
<div><a href="#"><img src="images/thumbs/1.jpg" alt="" class="thumb" /></a></div>
</div>
<div class="content">
<div><a href="#"><img src="images/thumbs/2.jpg" alt="" class="thumb" /></a></div>
</div>
<div class="content">
<div><a href="#"><img src="images/thumbs/3.jpg" alt="" class="thumb" /></a></div>
</div>
<div class="content">
<div><a href="#"><img src="images/thumbs/4.jpg" alt="" class="thumb" /></a></div>
</div>
<div class="content">
<div><a href="#"><img src="images/thumbs/5.jpg" alt="" class="thumb" /></a></div>
</div>
<div class="content">
<div><a href="#"><img src="images/thumbs/6.jpg" alt="" class="thumb" /></a></div>
</div>
<div class="content">
<div><a href="#"><img src="images/thumbs/7.jpg" alt="" class="thumb" /></a></div>
</div>
<div class="content">
<div><a href="#"><img src="images/thumbs/8.jpg" alt="" class="thumb" /></a></div>
</div>
</div>
</div>
</div>
<!-- The JavaScript -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript">
$(function() {
//index of current item
var current = 0;
//speeds / ease type for animations
var fadeSpeed = 400;
var animSpeed = 600;
var easeType = 'easeOutCirc';
//caching
var $thumbScroller = $('#thumbScroller');
var $scrollerContainer = $thumbScroller.find('.container');
var $scrollerContent = $thumbScroller.find('.content');
var $pg_title = $('#pg_title');
var $pg_preview = $('#pg_preview');
var $pg_desc1 = $('#pg_desc1');
var $pg_desc2 = $('#pg_desc2');
var $overlay = $('#overlay');
//number of items
var scrollerContentCnt = $scrollerContent.length;
var sliderHeight = $(window).height();
//we will store the total height
//of the scroller container in this variable
var totalContent = 0;
//one items height
var itemHeight = 0;
//First let's create the scrollable container,
//after all its images are loaded
var cnt = 0;
$thumbScroller.find('img').each(function(){
var $img = $(this);
$('<img/>').load(function(){
++cnt;
if(cnt == scrollerContentCnt){
//one items height
itemHeight = $thumbScroller.find('.content:first').height();
buildScrollableItems();
//show the scrollable container
$thumbScroller.stop().animate({'left':'0px'},animSpeed);
}
}).attr('src',$img.attr('src'));
});
//when we click an item from the scrollable container
//we want to display the items content
//we use the index of the item in the scrollable container
//to know which title / image / descriptions we will show
$scrollerContent.bind('click',function(e){
var $this = $(this);
var idx = $this.index();
//if we click on the one shown then return
if(current==idx) return;
//if the current image is enlarged,
//then we will remove it but before
//we animate it just like we would do with the thumb
var $pg_large = $('#pg_large');
if($pg_large.length > 0){
$pg_large.animate({'left':'350px','opacity':'0'},animSpeed,function(){
$pg_large.remove();
});
}
//get the current and clicked items elements
var $currentTitle = $pg_title.find('h1:nth-child('+(current+1)+')');
var $nextTitle = $pg_title.find('h1:nth-child('+(idx+1)+')');
var $currentThumb = $pg_preview.find('img.pg_thumb:eq('+current+')');
var $nextThumb = $pg_preview.find('img.pg_thumb:eq('+idx+')');
var $currentDesc1 = $pg_desc1.find('div:nth-child('+(current+1)+')');
var $nextDesc1 = $pg_desc1.find('div:nth-child('+(idx+1)+')');
var $currentDesc2 = $pg_desc2.find('div:nth-child('+(current+1)+')');
var $nextDesc2 = $pg_desc2.find('div:nth-child('+(idx+1)+')');
//the new current is now the index of the clicked scrollable item
current = idx;
//animate the current title up,
//hide it, and animate the next one down
$currentTitle.stop().animate({'top':'-50px'},animSpeed,function(){
$(this).hide();
$nextTitle.show().stop().animate({'top':'25px'},animSpeed);
});
//show the next image,
//animate the current to the left and fade it out
//so that the next gets visible
$nextThumb.show();
$currentThumb.stop().animate({'left': '350px','opacity':'0'},animSpeed,function(){
$(this).hide().css({
'left' : '250px',
'opacity' : 1,
'z-index' : 1
});
$nextThumb.css({'z-index':9999});
});
//animate both current descriptions left / right and fade them out
//fade in and animate the next ones right / left
$currentDesc1.stop().animate({'left':'205px','opacity':'0'},animSpeed,function(){
$(this).hide();
$nextDesc1.show().stop().animate({'left':'250px','opacity':'1'},animSpeed);
});
$currentDesc2.stop().animate({'left':'295px','opacity':'0'},animSpeed,function(){
$(this).hide();
$nextDesc2.show().stop().animate({'left':'250px','opacity':'1'},animSpeed);
});
e.preventDefault();
});
//when we click a thumb, the thumb gets enlarged,
//to the sizes of the large image (fixed values).
//then we load the large image, and insert it after
//the thumb. After that we hide the thumb so that
//the large one gets displayed
$pg_preview.find('.pg_thumb').bind('click',showLargeImage);
//enlarges the thumb
function showLargeImage(){
//if theres a large one remove
$('#pg_large').remove();
var $thumb = $(this);
$thumb.unbind('click');
var large_src = $thumb.attr('alt');
$overlay.fadeIn(200);
//animate width to 600px,height to 500px
$thumb.stop().animate({
'width' : '600px',
'height': '500px'
},500,function(){
$('<img id="pg_large"/>').load(function(){
var $largeImg = $(this);
$largeImg.insertAfter($thumb).show();
$thumb.hide().css({
'left' : '250px',
'opacity' : 1,
'z-index' : 1,
'width' : '360px',
'height' : '300px'
});
//when we click the large image
//we revert the animation
$largeImg.bind('click',function(){
$thumb.show();
$overlay.fadeOut(200);
$(this).stop().animate({
'width' : '360px',
'height': '300px'
},500,function(){
$(this).remove();
$thumb.css({'z-index' : 9999});
//bind again the click event
$thumb.bind('click',showLargeImage);
});
});
}).attr('src',large_src);
});
}
//resize window event:
//the scroller container needs to update
//its height based on the new windows height
$(window).resize(function() {
var w_h = $(window).height();
$thumbScroller.css('height',w_h);
sliderHeight = w_h;
});
//create the scrollable container
//taken from Manos :
//http://manos.malihu.gr/jquery-thumbnail-scroller
function buildScrollableItems(){
totalContent = (scrollerContentCnt-1)*itemHeight;
$thumbScroller.css('height',sliderHeight)
.mousemove(function(e){
if($scrollerContainer.height()>sliderHeight){
var mouseCoords = (e.pageY - this.offsetTop);
var mousePercentY = mouseCoords/sliderHeight;
var destY = -(((totalContent-(sliderHeight-itemHeight))-sliderHeight)*(mousePercentY));
var thePosA = mouseCoords-destY;
var thePosB = destY-mouseCoords;
if(mouseCoords==destY)
$scrollerContainer.stop();
else if(mouseCoords>destY)
$scrollerContainer.stop()
.animate({
top: -thePosA
},
animSpeed,
easeType);
else if(mouseCoords<destY)
$scrollerContainer.stop()
.animate({
top: thePosB
},
animSpeed,
easeType);
}
}).find('.thumb')
.fadeTo(fadeSpeed, 0.6)
.hover(
function(){ //mouse over
$(this).fadeTo(fadeSpeed, 1);
},
function(){ //mouse out
$(this).fadeTo(fadeSpeed, 0.6);
}
);
}
});
</script>
</body>
</code> |
Partager