/* ================================================= // // jquery fixed plugins 1.3.1 // author : �������� // url: www.52web.me // data : 2012-03-30 // // ���� : float --> ��������[left or right] // minstatue --> ��с״̬��ֻ��show_btn // skin --> ƥ����� // durationtime --> ���ʱ�� //���� : $("#scrollsidebar2").fix({ float : 'right', //default.left or right minstatue : true, //default.false or true skin : 'green', //default.gray or yellow ��blue ��green ��orange ��white durationtime : 1000 // }); // // =================================================*/ ;(function($){ $.fn.fix = function(options){ var defaults = { float : 'left', minstatue : false, skin : 'blue', durationtime : 1000 } var options = $.extend(defaults, options); this.each(function(){ //��ȡ���� var thisbox = $(this), closebtn = thisbox.find('.close_btn' ), show_btn = thisbox.find('.show_btn' ), sidecontent = thisbox.find('.side_content'), sidelist = thisbox.find('.side_list') ; var defaulttop = thisbox.offset().top; //�����ĭ��top thisbox.css(options.float, 0); if(options.minstatue){ $(".show_btn").css("float", options.float); sidecontent.css('width', 0); show_btn.css('width', 25); } //ƥ����� if(options.skin) thisbox.addclass('side_'+options.skin); //����scroll�¼� $(window).bind("scroll",function(){ var offsettop = defaulttop + $(window).scrolltop() + "px"; thisbox.animate({ top: offsettop }, { duration: options.durationtime, queue: false //�˶����������붯������ }); }); //close�¼� closebtn.bind("click",function(){ sidecontent.animate({width: '0px'},"fast"); show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast"); }); //show�¼� show_btn.click(function() { $(this).animate({width: '0px'},"fast"); sidecontent.stop(true, true).delay(200).animate({ width: '154px'},"fast"); }); }); //end this.each }; })(jquery);