Объединение двух js скриптов в один

Все блоги / DLE движок для сайтов 27 октября 2013 0   
Есть два скрипта:
/* #1 */
$(document).ready(function(){var a=$("#header-1").offset().top;$(window).scroll(function(){if($(window).scrollTop()>a){$("#header-1").css({position:"fixed",top:"-2px"})}else{$("#header-1").css({position:"static"})}})});
/* #2 */
$(document).ready(function(){var b=$("#header-2").offset().top;$(window).scroll(function(){if($(window).scrollTop()>b){$("#header-2").css({position:"fixed",top:"-2px"})}else{$("#header-2").css({position:"static"})}})});
Отличаются они только #header-1 и #header-2. Можно как то склеить все в один скрипт?

 Источник:dle-faq.pro, DLE

Похожие публикации

@
  • bowtiesmilelaughingblushsmileyrelaxedsmirk
    heart_eyeskissing_heartkissing_closed_eyesflushedrelievedsatisfiedgrin
    winkstuck_out_tongue_winking_eyestuck_out_tongue_closed_eyesgrinningkissingstuck_out_tonguesleeping
    worriedfrowninganguishedopen_mouthgrimacingconfusedhushed
    expressionlessunamusedsweat_smilesweatdisappointed_relievedwearypensive
    disappointedconfoundedfearfulcold_sweatperseverecrysob
    joyastonishedscreamtired_faceangryragetriumph
    sleepyyummasksunglassesdizzy_faceimpsmiling_imp
    neutral_faceno_mouthinnocent

Архив публикаций