/* * to change this license header, choose license headers in project properties. * to change this template file, choose tools | templates * and open the template in the editor. */ $(document).ready(function () { $(".fixediv a").click(function () { $(".fixediv").fadeout(400); }); $(".fixediv").floatadv(); }); jquery.fn.floatadv = function (loaded) { var obj = this; body_height = parseint($(window).height()); block_height = parseint(obj.height()); top_position = parseint((body_height / 2) - (block_height / 2) + $(window).scrolltop()); if (body_height < block_height) { top_position = 0 + $(window).scrolltop(); } if (!loaded) { obj.css({'position': 'absolute'}); obj.css({'top': top_position}); $(window).bind('resize', function () { obj.floatadv(!loaded); }); $(window).bind('scroll', function () { obj.floatadv(!loaded); }); } else { obj.stop(); obj.css({'position': 'absolute'}); obj.animate({'top': top_position}, 400, 'linear'); } }