(function($){ $.fn.capacityfixed = function(options) { var opts = $.extend({},$.fn.capacityfixed.deflunt,options); var fixedfun = function(element) { var top = opts.top; element.css({ "top":top }); $(window).scroll(function() { var scrolls = $(this).scrolltop(); if (scrolls > top) { if (window.xmlhttprequest) { element.css({ }); } else { element.css({ top: scrolls }); } }else { element.css({ }); } }); element.find(".close-ico").click(function(event){ element.remove(); event.preventdefault(); }) }; return $(this).each(function() { fixedfun($(this)); }); }; })(jquery);