leafo / sticky-kit

A jQuery plugin for creating smart sticky elements
http://leafo.net/sticky-kit
2.9k stars 517 forks source link

change offset_top dinamyc #183

Open d-kochanzhi opened 8 years ago

d-kochanzhi commented 8 years ago

I added a feature to change the offset top, when we need to show two or more sticky elements in page one under another.

refresh = function (event, opts) {
         if (opts == null) {
            opts = { };
        }       
         if (opts.offset_top != null && offset_top !== opts.offset_top) {
            offset_top = opts.offset_top;
            recalc_and_tick();
        }

      };

elm.on("sticky_kit:refresh", refresh);

using

 .on('sticky_kit:stick', function (e) {
       $("#element").trigger('sticky_kit:refresh', [{ offset_top: fixTop }]);          
 });

very usefull, can you add it to origin script?

jimmyko commented 7 years ago

Why not create a pull request?

steve231293 commented 3 years ago

Hello there Is this featured added in last version yet?