jquery(document).ready(function ($) { ////fancybox //$('.fancybox').fancybox({ // 'transitionin' : 'elastic', // 'transitionout' : 'elastic', // 'overlayopacity': 0.3 //}); $('ul.sf-menu').superfish(); //二级菜单hover //$('.dropdown-toggle').dropdownhover(); // slider $("#slider").responsiveslides({ auto: true, speed:800, pause: true, pager: false, nav: true, namespace: "callbacks" }); //teasers $('.teasers').hover( function(){ if( $(this).children('.icon').is(':animated')){ $(this).children('.icon').stop(); } $(this).children('.icon').animate({ 'backgroundposition': '0 -150px' }, { duration: 900, easing: 'swing' }); }, function(){ if( $(this).children('.icon').is(':animated')){ $(this).children('.icon').stop(); } $(this).children('.icon').animate({ 'backgroundposition': '-150 0px' }, { duration: 900, easing: 'swing' }); }) $(function(){ (function($) { $.extend($.fx.step,{ backgroundposition: function(fx) { if (fx.state === 0 && typeof fx.end == 'string') { var start = $.curcss(fx.elem,'backgroundposition'); start = toarray(start); fx.start = [start[0],start[2]]; var end = toarray(fx.end); fx.end = [end[0],end[2]]; fx.unit = [end[1],end[3]]; } var nowposx = []; nowposx[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0]; nowposx[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1]; fx.elem.style.backgroundposition = nowposx[0]+' '+nowposx[1]; function toarray(strg){ strg = strg.replace(/left|top/g,'0px'); strg = strg.replace(/right|bottom/g,'100%'); strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2"); var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/); return [parsefloat(res[1],10),res[2],parsefloat(res[3],10),res[4]]; } } }); })(jquery); }) });