jQuery.noConflict(); (function($) { $(function() { if (window.PIE) { $('.rounded').each(function() { PIE.attach(this); }); } if($('#slide-project').size()) { $('#slide-project').lofJSidernews( { wapperSelector : '#wrapper-slide', navItemsSelector : '#nav-slide li', interval : 4000, direction : 'opacity', easing : 'easeInOutQuad', duration : 1000, auto : true, maxItemDisplay : 3, startItem : 0, navPosition : 'vertical', // horizontal navigatorHeight : 55, navigatorWidth : 180, mainWidth : 551, buttons :null }); } if($('.carousels').size()) { $('.carousels').jcarousel({ scroll : 1, wrap : 'circular' }); } function initNavZindex() { $eachNav = $('#nav ul .first-lvl'); $allNav = $eachNav.size(); var $currentNav = 0; for(var $i = $allNav; $i>0; $i--) { var el = $eachNav[$currentNav]; $(el).css('zIndex', 100 + $i); $currentNav ++; } } initNavZindex(); if ( $.browser.msie && parseInt($.browser.version, 10) == 7 ) { $('#nav ul li ul').css('top','100%'); } }); })(jQuery); var Site = { init : function() { var body = jQuery("body:first"); var pageid = body.attr('id'); switch (pageid) { case 'product': Site.CatalogProduct.init(); break; case 'category': Site.CatalogProduct.init(); break; case 'search': Site.CatalogProduct.init(); break; case 'tendancesproducts': Site.CatalogProduct.init(); break; case 'order': Site.CatalogProduct.init(); break; case 'searchmarque': Site.CatalogProduct.init(); break; case 'home': Site.CatalogProduct.init(); break; } Site.CatalogBasket.init(); if(jQuery('.search-auto-completer')) { Site.AutocompleteSearch.init(); } } }; Site.Default = { init : function() {} }; Site.AutocompleteSearch = { init: function () { var searchfield = jQuery(".search-auto-completer"); jQuery(".search-auto-completer").autocomplete( { minLength: 3, autoFocus: true, source: 'js/search.js.php', /*focus : function( event, ui ) { console.log(ui.item); ui.item.addClass('auto-complete-selected'); },*/ select: function( event, ui ) { if( ui.item ) { searchfield.value = ui.item.value } } } ) } }; Site.CatalogProduct = { dialog: null, cart: null, init: function () { var self = Site.CatalogProduct; // Dialog self.initDialog(); // Cart Widget self.initWidgetCart(); jQuery(".btn-add").click(function() { var $this = jQuery(this); var url = $this.attr("href"); jQuery.ajax({ url: url, type: "get", dataType: "html", data: url, success: function(data){ self.dialog.html(data); self.dialog.dialog("open"); self.updateWidgetCart(); } }); return false; }); }, initDialog: function() { var self = Site.CatalogProduct; // Box self.dialog = jQuery("#dialog-cart"); if (!self.dialog || !self.dialog.length) { self.dialog = jQuery('
'); jQuery("body:first").append(self.dialog); } // Dialog self.dialog.dialog({ autoOpen: false, width: 600, modal: true, closeText: 'Close' }); self.dialog.delegate(".dialog-close", "click", function() { self.dialog.dialog("close"); return false; }); self.dialog.delegate(".continue-buy", "click", function() { self.dialog.dialog("close"); return false; }); }, initWidgetCart: function() { var self = Site.CatalogProduct; // Box self.cart = jQuery(".widget-basket"); }, updateWidgetCart: function() { var self = Site.CatalogProduct; var target_url = "http://www.lesjouetsenbois.eu/js/"; jQuery.ajax({ url: target_url + "partialbasketproduct.js.php", type: "get", dataType: "html", success: function(data){ self.cart.html(data); } }); } }; Site.CatalogBasket = { dialog: null, init: function () { var self = Site.CatalogBasket; // Dialog self.initDialog(); }, initDialog: function() { var self = Site.CatalogBasket; // Box self.dialog = jQuery("#dialog-basket"); // Dialog self.dialog.dialog({ autoOpen: true, width: 300, modal: true, closeText: 'Close' }); self.dialog.delegate(".dialog-close", "click", function() { self.dialog.dialog("close"); return false; }); self.dialog.delegate(".continue-buy", "click", function() { self.dialog.dialog("close"); return false; }); } }; jQuery(Site.init);