$(function () { $('#collectionSelect').change(function () { document.location.href = _current_url + $(this).val() + '.html'; }); $('.mainSelect').appendTo($('body')); { // скроллер на главной странице $('.catalogueScroll').smoothDivScroll({ visibleHotSpots: "always", autoScroll: 'always', autoScrollDirection: "endlessloopright", autoScrollStep: 1, autoScrollInterval: 50 }); $('.catalogueScroll').hover(function () { $(this).smoothDivScroll("stopAutoScroll"); return false; }, function () { $(this).smoothDivScroll("startAutoScroll"); }); $('.scrollingLeft').hover(function () { $('.catalogueScroll') .smoothDivScroll('setOption', { autoScrollDirection: 'endlessloopleft', autoScrollStep: 5, autoScrollInterval: 10 }) .smoothDivScroll("startAutoScroll"); return false; }, function () { $('.catalogueScroll') .smoothDivScroll('setOption', { autoScrollDirection: 'endlessloopright', autoScrollStep: 1, autoScrollInterval: 50 }) .smoothDivScroll("stopAutoScroll"); }); $('.scrollingRight').hover(function () { $('.catalogueScroll') .smoothDivScroll('setOption', { autoScrollStep: 5, autoScrollInterval: 10 }) .smoothDivScroll("startAutoScroll"); return false; }, function () { $('.catalogueScroll') .smoothDivScroll('setOption', { autoScrollStep: 1, autoScrollInterval: 50 }) .smoothDivScroll("stopAutoScroll"); }); } { // фильтр var _ajaxSelectTimer = null; $('.foot .btn').click(function () { var _form = $(this).parents('form');; $('input[name=action]', _form).val('view'); _form.submit(); return false; }); /* считаем количество коллекций */ var ajaxCountCollections = function () { $('.mainSelect').addClass('ajaxSelect'); var _form = $('.mainSelect form'); $('input[name=action]', _form).val('ajaxCountCollections'); $.get(_form.attr('action'), _form.serialize(), function (data) { $('.selectResultCount').html(data); $('.mainSelect').removeClass('ajaxSelect'); if (parseInt(data) > 0) { $('.foot .btn').removeClass('inert'); } else { $('.foot .btn').addClass('inert'); } }); } var filterCheckboxClick = function (ckeckbox) { clearTimeout(_ajaxSelectTimer); var _this = ckeckbox, _parent = $(_this).parents('li'), _name = $(_this).attr('name').replace('[', '_').replace(']', ''); if ($(_this).is(':checked')) { $('.checked_items', _parent).append('' + $(_this).attr('rel') + ''); $('.' + _name).click(function () { _this.click(); }); } else { $('.' + _name, _parent).remove(); } _ajaxSelectTimer = setTimeout(ajaxCountCollections, 300); } $('.mainSelect input').click(function () { filterCheckboxClick(this); }); $('.mainSelect input:checked').each(function () { filterCheckboxClick(this); }); } var _initVerticalCatalogPreview = function () { if ($('.jcarousel-skin-bg LI').length > 4) { $('.jcarousel-skin-bg').jcarousel({scroll: 1, vertical: true}); } $('.jcarousel-skin-bg A').click(function () { $('.jcarousel-skin-bg LI').removeClass('current'); $('.photoIn').append(''); $('.photoIn IMG:last').load(function () { $('.photoIn IMG:first').fadeOut(1000); $('.photoIn IMG:last').fadeIn(1000, function () { $('.photoIn IMG:first').remove(); }); }); $(this).parents('li:first').addClass('current'); return false; }) } _initVerticalCatalogPreview(); var _carouselDescription = null, _carouselWorks = null; $('.jcarousel-skin-works').jcarousel({ scroll: 3, start: $('.jcarousel-skin-works LI').index($('.jcarousel-skin-works LI.current')) + 1, initCallback: function (carousel) { _carouselWorks = carousel; } }) $('.jcarousel-skin-description').jcarousel({ scroll: 1, start: $('.jcarousel-skin-description LI').index($('.jcarousel-skin-description LI.current')) + 1, initCallback: function (carousel) { _carouselDescription = carousel; } }) $('.jcarousel-skin-description .slider>span').click(function(){ if($(this).parent().prev('.info').is(':visible')){ $(this).parent().prev('.info').slideUp(200); $(this).html('О коллекции'); }else{ $(this).parent().prev('.info').slideDown(200); $(this).html('Свернуть'); } }) { // $('.jcarousel-skin-works A').click(function () { historyPage.GoTo($(this).attr('href'), 'catalog'); return false; }) historyPage.addCallBack(function (url) { var _parentCatalogLi = $('.jcarousel-skin-works a[href="' + url + '"]').parents('LI:first'), position = $('.jcarousel-skin-works LI').index(_parentCatalogLi); $.get(_current_url + url, {'action' : 'getCollectionData'}, function (object) { $('.jcarousel-skin-works LI.current').removeClass('current'); _parentCatalogLi.addClass('current'); $('.photoIn').append(''); $('.photoIn IMG:last').load(function () { $('.photoIn IMG:first').fadeOut(1000); $('.photoIn IMG:last').fadeIn(1000, function () { $('.photoIn IMG:first').remove(); }); $('.jcarousel-skin-bg').replaceWith(''); if (object.images.length > 1) { for(var i = 0, length = object.images.length; i < length; i++) { $('.jcarousel-skin-bg').append('
  • ') } } // перелистываем описание на текущий пункт _carouselDescription.scroll(position + 1, 1000); _carouselWorks.scroll(position - 2, 1000); _initVerticalCatalogPreview(); }) }, 'json'); }, 'catalog'); var hash_temp = location.toString().split('#'); if ( hash_temp[1] ) { historyPage.GoTo(hash_temp[1], 'catalog'); } } });