I have implemented stickyfloat (http://plugins.jquery.com/files/stickyfloat_0.htm) on a site. It works great with one gotcha. The function triggers on $(window).scroll
and not on $(window).load
. I want it to trigger on either because I am linking to anchor points in the page (http://tre-stage.wdogsystems.com:8000/faq/#does-the-sale-of-my-receivables-have-a-negative-effect-on-my-credit-report) and I would like the side menu to appear when the page loads and not just when I initiate a scroll.
If you look at the page above, it's working just as I want it to. However, this is only because I've repeated the same function with a $(window).load
. This seems highly inefficient to me. So, is there a way to chain the two together?
For example:
$(window).scroll || $(window).load (function () ...
jQuery's .bind()
help method allows multiple events bound at once.
$(window).bind('scroll load', function() {
// code here triggers for both, scroll & load events
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With