Problem:
The issue here is that the user wanted to have some of their text to be sticky so that it scrolls with the user when they scroll on the browser page.
Solution:
You can use the follow to do this.
HTML
<div id="sticky-anchor"></div> <div class="sticky"><h5>[wpv-post-link]</h5></div>
CSS
.stick { position: fixed; top: 0; z-index: 10000; }
Javascript
function sticky_relocate() { var window_top = jQuery(window).scrollTop(); var div_top = jQuery('#sticky-anchor').offset().top; if (window_top > div_top) { jQuery('.sticky').addClass('stick'); } else { jQuery('.sticky').removeClass('stick'); } } jQuery(function() { jQuery(window).scroll(sticky_relocate); sticky_relocate(); });
So what this does is that it detects the browser scroll and then applies the css to stick the items to the top of the page.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 6 replies, has 2 voices.
Last updated by 5 years, 1 month ago.
Assisted by: Shane.