jak wywołać ją poprawnie dla okna i zdarzeń resize() i addEventListener()?
['scroll', 'resize'].forEach(function(e){ window.addEventListener(e, function(){resize(A);},false); });
<script> function icons(){ if(600 < jQuery(window).width()){ var distanceY = window.pageYOffset, sharePost = document.querySelector(".share-post"), elementHeight1 = jQuery('.header-wrapper').height(), elementHeight2 = jQuery('.page-heading').height(), elementHeight3 = jQuery('.wp-picture').height(), elementHeight4 = jQuery('.date').height(), elementHeight5 = jQuery('.fixed-header').height(), shrinkOn; shrinkOn = elementHeight1 + elementHeight2 + elementHeight3 + elementHeight4 + elementHeight5; if (distanceY > shrinkOn) { classie.add(sharePost,"smaller"); } else { if (classie.has(sharePost,"smaller")) { classie.remove(sharePost,"smaller"); } } var vpH = jQuery(window).height(), st = jQuery(window).scrollTop(), y = jQuery('.ssba').offset().top, elementHeight = jQuery('.ssba').height(); if (y < (vpH + st)) { classie.remove(sharePost,"smaller"); } } } function init() { ['scroll', 'resize'].forEach(function(e){ window.addEventListener(e, function(r){resize(icons);},false); }); </script>