$(function () { $('#portfolioFilterForm select').change(function () { var _form = $(this).parents('form'); $.post(_link_portfolio + '?action=CountProjects&ajax=1', _form.serialize(), function (data) { $('.found_portfolio_str span').html(data); if (data == 0) { $('input[type=submit]', _form) .addClass('disable') .attr('disabled', 'disabled'); } else { $('input[type=submit]', _form) .removeClass('disable') .removeAttr('disabled'); } }) }); $('#protfolio_gallery ul').jcarousel({ scroll: 1, itemVisibleOutCallback : function () { if ($('#protfolio_gallery .jcarousel-prev').is('.jcarousel-prev-disabled')) { $('#controlls_portfolio .left a').addClass('disabled'); } else { $('#controlls_portfolio .left a').removeClass('disabled'); } if ($('#protfolio_gallery .jcarousel-next').is('.jcarousel-next-disabled')) { $('#controlls_portfolio .right a').addClass('disabled'); } else { $('#controlls_portfolio .right a').removeClass('disabled'); } } }); $('#controlls_portfolio .left a').click(function () { $('#protfolio_gallery .jcarousel-prev').click(); return false; }); $('#controlls_portfolio .right a').click(function () { $('#protfolio_gallery .jcarousel-next').click(); return false; }); if ($('#protfolio_gallery LI').length <= 1) { $('#controlls_portfolio .right a').addClass('disabled'); } });