sticky icon indicating copy to clipboard operation
sticky copied to clipboard

topSpacing based on element

Open wpexplorer opened this issue 9 years ago • 2 comments

topSpacing: $( '.my-element' ),

This would be very useful. Would need to update on re-size of course ;) Thanks for considering!

wpexplorer avatar Aug 28 '15 22:08 wpexplorer

You can get the height of an element with jquery, then use that variable in your sticky function.

var elementHeight = $('#sticky-element-1').outerHeight();

$("#sticky-element-2").sticky({ topSpacing: elementHeight });

joncjordan avatar Oct 21 '15 19:10 joncjordan

Yes of course that can be done. But this is something that would be nice to have in the script itself.

wpexplorer avatar Oct 22 '15 17:10 wpexplorer