function setScreenClass() { var w = $(window).width(); var cl = (w<=420)?'pda':(w>420&&w<=1024)?'mini':''; $('body').attr('class', cl); }; $(window) .load(function() { setScreenClass(); }).resize(function() { setScreenClass(); }); $(function() { $('.h__menu > li').hover( function () { /*$('.h__menu > li > a').removeClass('hover'); $('.h__menu > li > ul').hide();*/ $(this).children('ul').stop(true, true).slideDown(200); $(this).children('a').addClass('hover'); }, function () { var that = this; $(this).children('ul').stop(true, true).delay(300).slideUp(100, function() { $(that).children('a').removeClass('hover'); }); if ($(this).hasClass('single')) { $(that).children('a').removeClass('hover'); } } ); $('.noclick').css('cursor', 'text'); $('.noclick').click(function () { return false; }); $('.external-link').click(function () { location.href = $(this).data('url'); return false; }); $('.league-banners li').click(function () { if (!$(this).hasClass('league-active')) { $(this).parent().find('li').removeClass('league-active'); $(this).addClass('league-active'); } }); $("a[rel^='fancy']").fancybox({ //'OverlayShow' : false, 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', /*'speedIn' : 500, 'speedOut' : 400,*/ 'hideOnContentClick' : true, 'titlePosition' : 'over', 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { if (currentArray.length > 1) { return '' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? '   ' + title : '') + ''; } else { if (title.length) { return '' + title + ''; } else { return ''; } } } }); $('#searchtype').change(function () { if ($(this).val() == 'date') { $('#searchterm').datepicker({ dateFormat: 'yy-mm-dd' }); } else { $('#searchterm').datepicker('destroy'); } }); $('#select_page').change(function () { $('#select_page_form').submit(); }); $('#searchterm').datepicker({ dateFormat: 'yy-mm-dd' }); $('.fordatepicker').datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true }); $.each($('iframe[allowfullscreen]'), function(index, value) { var w = $(this).attr('width'), h = $(this).attr('height'); $(this).attr('width', 500).attr('height', parseInt(500 * h / w)); }); $('#to-top').click(function () { $("html, body").animate({ scrollTop: 0 }, "fast"); }); /* fixed nav */ if(!navigator.userAgent.match(/MSIE/i)) { var $win = $(window), $nav = $('.h__menu_wrap'), navTop = $('.h__menu_wrap').length && $nav.offset().top; $win.scroll(function () { var scrollTop = $win.scrollTop(); if ($nav.length) { if (scrollTop >= navTop + 16){ $nav.addClass('fixed'); $('#to-top').show(); } else { $nav.removeClass('fixed'); $('#to-top').hide(); } } }); } if(navigator.userAgent.match(/Android/i)) { $('.wrapper-bg').css({ 'position': 'absolute' }) } });