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 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
| <!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-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Resizeable demo - Interface plugin for jQuery</title>
<script type="text/javascript" src="js/jquery.js"></script>
<!-- <script language="javascript" src="js/menu/menu/jquery-1.2.6.js"></script>-->
<script type="text/javascript" src="interface/interface.js"></script>
<style type="text/css" media="all">
body
{
background: #fff;
height: 100%;
}
#window
{
position: absolute;
left: 200px;
top: 100px;
width: 400px;
height: 300px;
overflow: hidden;
display: none;
}
#windowTop
{
height: 30px;
overflow: 30px;
background-image: url(images/window_top_end_b.png);
background-position: right top;
background-repeat: no-repeat;
position: relative;
overflow: hidden;
cursor: move;
}
#windowTopContent
{
margin-right: 13px;
background-image:url(images/window_top_start_b.png);
background-position:left top;
background-repeat: no-repeat;
overflow: hidden;
height: 30px;
line-height: 30px;
text-indent: 10px;
font-family:Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 14px;
color: red;
}
#windowMin
{
position: absolute;
right: 25px;
top: 10px;
cursor: pointer;
}
#windowMax
{
position: absolute;
right: 25px;
top: 10px;
cursor: pointer;
display: none;
}
#windowClose
{
position: absolute;
right: 10px;
top: 10px;
cursor: pointer;
}
#windowBottom
{
position: relative;
height: 270px;
background-image: url(images/window_bottom_end_b.png);
background-position: right bottom;
background-repeat: no-repeat;
}
#windowBottomContent
{
position: relative;
height: 270px;
background-image: url(images/window_bottom_start_b.png);
background-position: left bottom;
background-repeat: no-repeat;
margin-right: 13px;
}
#windowResize
{
position: absolute;
right: 3px;
bottom: 5px;
cursor: se-resize;
}
#windowContent
{
position:absolute;
top: 30px;
left: 10px;
width: auto;
height: auto;
overflow: auto;
margin-right: 10px;
border: 1px solid #6caf00;
height: 255px;
width: 375px;
font-family:Arial, Helvetica, sans-serif;
font-size: 11px;
background-color: #fff;
}
#windowContent *
{
margin: 10px;
}
.transferer2
{
border: 1px solid #6BAF04;
background-color: #B4F155;
filter:alpha(opacity=30);
-moz-opacity: 0.3;
opacity: 0.3;
}
#cart
{
width: 200px;
border: 1px solid #eee;
float: right;
}
#cart h3
{
background-color: #6CAF00;
padding: 4px;
color: #000;
font-size: 12px;
color: #fff;
}
#cart p
{
padding: 10px 4px;
}
.cart
{
background-color: #f8f8f8;
}
.activeCart
{
background-color: #DAFF9F;
}
.hoverCart
{
background-color:#FFFFCC;
}
#products
{
margin-right: 250px;
width: 600px;
}
.product
{
width: 200px;
height: 200px;
float: left;
margin-bottom: 20px;
}
.product img
{
cursor: pointer;/*move*/
}
.product h2
{
font-size: 12px;
padding: 6px 0;
}
.product p
{
font-size: 11px;
color: #333;
}
.product a
{
color: #6CAF00;
}
.productCart
{
font-size: 10px;
margin: 10px;
}
.productCart a
{
color: #f00;
float: right;
}
.transferProduct
{
border: 1px solid #6CAF00;
}
</style>
</head>
<body>
<div id="cart" class="cart">
<h3>Your cart</h3>
<div id="cartProducts"></div>
<p><strong>Total: <span id="cartTotal">0.-</span> $</strong></p>
</div>
<h1>Drag products into shopping cart</h1>
<div id="products">
<div id="windowOpen" >
<div id="Product1" class="product">
<img src="images/fkg/FKG INSTRUMENT RACE.jpg" width="100" height="150" title="fkg" />
<h2>Product 1</h2>
<p>Long sleeve, stripes</p>
<p><strong>Price: <span>49.95</span> $</strong></p>
<a href="#">add to cart</a>
</div>
</div>
<div id="window">
<div id="windowTop">
<div id="windowTopContent">Window example</div>
<img src="images/window_min_b.jpg" id="windowMin" />
<img src="images/window_max_b.jpg" id="windowMax" />
<img src="images/window_close_b.jpg" id="windowClose" />
</div>
<div id="windowBottom"><div id="windowBottomContent"> </div></div>
<div id="windowContent"><p>aaaaaaaaaaaaaaaaaaaaaaaaa, consectetuer adipiscing elit. Ut eget lectus in diam iaculis tempor. Suspendisse consectetuer, justo nec euismod sodales, augue nisi convallis diam, in posuere pede turpis at massa. Donec mi nunc, iaculis eu, vehicula sed, malesuada eget, ligula. In eu urna. Suspendisse pede quam, tempor id, tempor at, placerat eget, massa. Maecenas porta elementum tellus. Ut nulla diam, posuere non, consequat nec, fermentum vitae, turpis. Pellentesque tempor metus at lorem. Donec nulla ipsum, euismod in, pretium vitae, ornare nonummy, lectus. Aliquam ullamcorper. Vestibulum eget leo. Proin pretium, enim vitae bibendum accumsan, dolor urna feugiat felis, et ultrices ipsum odio et dui. Praesent non eros sit amet nisi laoreet aliquet. Nulla diam. Maecenas et sem eget lorem porttitor tincidunt. Donec sed dui. </p>
<p>Nam non dolor. Donec ultricies mattis libero. Donec ac eros. Praesent id arcu. Phasellus odio massa, blandit nec, iaculis ac, blandit nec, enim. Nunc rutrum. Mauris pretium mattis nunc. Integer lectus. Suspendisse potenti. Ut dignissim enim eget ipsum. Suspendisse eget nulla ac dolor volutpat pellentesque. Donec odio diam, pulvinar sed, ornare a, semper in, nisi. Duis a odio id enim lacinia fringilla. Integer rutrum erat in ante. Morbi eleifend ipsum vel quam. Vestibulum in mauris. Donec vulputate hendrerit nulla. </p>
<p>Phasellus nulla ipsum, dapibus et, laoreet quis, volutpat sed, nibh. Nunc massa ipsum, vehicula et, ullamcorper fermentum, imperdiet vitae, enim. Morbi non augue. Morbi vitae sapien. Nulla at metus. Pellentesque a sem id arcu faucibus tincidunt. Pellentesque sit amet urna quis arcu elementum volutpat. Sed sed sapien. Suspendisse cursus. Nulla commodo libero ac tortor dictum pulvinar. Mauris id leo non velit iaculis mollis. Fusce at augue ut mi laoreet molestie. Quisque facilisis. Maecenas ornare mattis justo. Vestibulum vel lorem in nisl venenatis semper. Aliquam erat volutpat. Aliquam tellus turpis, posuere eu, commodo sed, fermentum sit amet, mi. </p>
</div>
<img src="images/window_resize.gif" id="windowResize" />
</div>
<div id="windowOpen" >
<div id="product2" class="product">
<img src="images/fkg/fkg photo instrument.jpg" width="200" height="100" />
<h2>Product 2</h2>
<p>autres produits, stripes</p>
<p><strong>Price: <span>29.95</span> $</strong></p>
<a href="#">add to cart</a>
</div>
</div>
<div id="window">
<div id="windowTop">
<div id="windowTopContent">Window example</div>
<img src="images/window_min_b.jpg" id="windowMin" />
<img src="images/window_max_b.jpg" id="windowMax" />
<img src="images/window_close_b.jpg" id="windowClose" />
</div>
<div id="windowBottom"><div id="windowBottomContent"> </div></div>
<div id="windowContent"><p>bbbbbbbbbbbbbbbbbbbbbb, consectetuer adipiscing elit. Ut eget lectus in diam iaculis tempor. Suspendisse consectetuer, justo nec euismod sodales, augue nisi convallis diam, in posuere pede turpis at massa. Donec mi nunc, iaculis eu, vehicula sed, malesuada eget, ligula. In eu urna. Suspendisse pede quam, tempor id, tempor at, placerat eget, massa. Maecenas porta elementum tellus. Ut nulla diam, posuere non, consequat nec, fermentum vitae, turpis. Pellentesque tempor metus at lorem. Donec nulla ipsum, euismod in, pretium vitae, ornare nonummy, lectus. Aliquam ullamcorper. Vestibulum eget leo. Proin pretium, enim vitae bibendum accumsan, dolor urna feugiat felis, et ultrices ipsum odio et dui. Praesent non eros sit amet nisi laoreet aliquet. Nulla diam. Maecenas et sem eget lorem porttitor tincidunt. Donec sed dui. </p>
<p>Nam non dolor. Donec ultricies mattis libero. Donec ac eros. Praesent id arcu. Phasellus odio massa, blandit nec, iaculis ac, blandit nec, enim. Nunc rutrum. Mauris pretium mattis nunc. Integer lectus. Suspendisse potenti. Ut dignissim enim eget ipsum. Suspendisse eget nulla ac dolor volutpat pellentesque. Donec odio diam, pulvinar sed, ornare a, semper in, nisi. Duis a odio id enim lacinia fringilla. Integer rutrum erat in ante. Morbi eleifend ipsum vel quam. Vestibulum in mauris. Donec vulputate hendrerit nulla. </p>
<p>Phasellus nulla ipsum, dapibus et, laoreet quis, volutpat sed, nibh. Nunc massa ipsum, vehicula et, ullamcorper fermentum, imperdiet vitae, enim. Morbi non augue. Morbi vitae sapien. Nulla at metus. Pellentesque a sem id arcu faucibus tincidunt. Pellentesque sit amet urna quis arcu elementum volutpat. Sed sed sapien. Suspendisse cursus. Nulla commodo libero ac tortor dictum pulvinar. Mauris id leo non velit iaculis mollis. Fusce at augue ut mi laoreet molestie. Quisque facilisis. Maecenas ornare mattis justo. Vestibulum vel lorem in nisl venenatis semper. Aliquam erat volutpat. Aliquam tellus turpis, posuere eu, commodo sed, fermentum sit amet, mi. </p>
</div>
<img src="images/window_resize.gif" id="windowResize" />
</div>
</div>
<script type="text/javascript">
$(document).ready(
function()
{
var numw = '#window';
$('#windowOpen').bind(
'click',
function() {
if($(numw).css('display') == 'none') {/*'#window'*/
$(this).TransferTo(
{
to:'window',
className:'transferer2',
duration: 400,
complete: function()
{
$(numw).show();/*'#window'*/
}
}
);
}
this.blur();
return false;
}
);
$('#windowClose').bind(
'click',
function()
{
$(numw).TransferTo(/*'#window'*/
{
to:'windowOpen',
className:'transferer2',
duration: 400
}
).hide();
}
);
$('#windowMin').bind(
'click',
function()
{
$('#windowContent').SlideToggleUp(300);
$('#windowBottom, #windowBottomContent').animate({height: 10}, 300);
$(numw).animate({height:40},300).get(0).isMinimized = true;/*'#window'*/
$(this).hide();
$('#windowResize').hide();
$('#windowMax').show();
}
);
$('#windowMax').bind(
'click',
function()
{
var windowSize = $.iUtil.getSize(document.getElementById('windowContent'));
$('#windowContent').SlideToggleUp(300);
$('#windowBottom, #windowBottomContent').animate({height: windowSize.hb + 13}, 300);
$(numw).animate({height:windowSize.hb+43}, 300).get(0).isMinimized = false;/*'#window'*/
$(this).hide();
$('#windowMin, #windowResize').show();
}
);
$(numw).Resizable(/*'#window'*/
{
minWidth: 200,
minHeight: 60,
maxWidth: 700,
maxHeight: 400,
dragHandle: '#windowTop',
handlers: {
se: '#windowResize'
},
onResize : function(size, position) {
$('#windowBottom, #windowBottomContent').css('height', size.height-33 + 'px');
var windowContentEl = $('#windowContent').css('width', size.width - 25 + 'px');
if (!document.getElementById(numw).isMinimized) {/*'#window'*/
windowContentEl.css('height', size.height - 48 + 'px');
}
}
}
);
}
)
;
</script>
<script type="text/javascript">
$(document).ready(
function()
{
$('#products a')
.bind(
'click',
function() {
$(this.parentNode)
.TransferTo(
{
to:addProductToCart(this.parentNode),
className:'transferProduct',
duration: 400
}
);
return false;
}
);
$('div.product').Draggable({revert: true, fx: 300, ghosting: true, opacity: 0.4});
$('#cart').Droppable(
{
accept : 'product',
activeclass: 'activeCart',
hoverclass: 'hoverCart',
tolerance: 'intersect',
onActivate: function(dragged)
{
if (!this.shakedFirstTime) {
$(this).Shake(3);
this.shakedFirstTime = true;
}
},
onDrop: addProductToCart
}
);
}
);
var addProductToCart = function(dragged)
{
var cartItem;
var productName = $('h2', dragged).html();
var productPrice = parseFloat($('span', dragged).html());
var productId = $(dragged).attr('id');
var isInCart = $('#' + productId + '_cart');
if (isInCart.size() == 1) {
var quantity = parseInt(isInCart.find('span.quantity').html()) + 1;
isInCart.find('span.quantity').html(quantity+'').end().Pulsate(300, 2);
cartItem = isInCart.get(0);
} else {
$('#cartProducts')
.append('<div class="productCart" id="' + productId + '_cart">' + productName + '<a href="#">remove</a><br />qty: <span class="quantity">1</span><br />price: <span class="price">' + productPrice + ' $</span></div>')
.find('div.productCart:last')
.fadeIn(400)
.find('a')
.bind(
'click',
function(){
$(this.parentNode).DropOutDown(
400,
function() {
$(this).remove();
calculateCartTotal();
}
);
return false;
}
);
cartItem = $('div.productCart:last').get(0);
}
calculateCartTotal();
/*
alert(productName);
alert(productPrice);
alert(productId);
*/
return cartItem;
};
var calculateCartTotal = function()
{
var total = 0;
$('#cartProducts .productCart').each(
function()
{
var price = parseFloat($('span.price', this).html());
var quantity = parseInt($('span.quantity', this).html());
total += price * quantity;
}
);
$('#cartTotal').html(formatNr(total));
$('#cart p').Highlight(500, '#ff0', function(){$(this).css('backgroundColor', 'transparent');});
};
var formatNr = function(nr)
{
thousands = parseInt(nr/1000);
hundreds = parseInt(nr - thousands*1000);
decimals = parseInt((nr - parseInt(nr)) * 100);
return (thousands > 0 ? thousands + ' ' : '') + (nr > 1000 & hundreds < 100 ? '0' : '') + (nr > 1000 & hundreds < 10 ? '0' : '') + hundreds + '.' + (decimals > 0 ? decimals : '-');
}
</script>
</body>
</html> |
Partager