Thread Starter
mln83
(@mln83)
FYI: Before I found this plugin I also considered geeking around with this code:
https://blog.hartleybrody.com/creating-sticky-sidebar-widgets-that-scrolls-with-you/
Which is basically another way of sticking multiple IDs.
Thanks for your suggestion!
You’re not the first to request the option for multiple sticky elements — it’s been a popular request actually!
Unfortunately, it’s not a simple thing to do and will take quite a lot of time and testing…once I get around to it. I’m currently working on version 2 of the plugin, which should solve the single most requested feature, but rest assured that having more than one sticky element is the second most requested feature, so once I’m done with the 2.0 release, I will definitely start looking into that.
Thread Starter
mln83
(@mln83)
Sounds cool!
I understand that it’s not a straightforward thing to do. I can imagine a few possible ways of achieving it. Some ideas:
Option 1:
Encapsulation around sticky elements:
<div id="catcher">
<!--catcher-->
Insert sticky elements (IDs / DIVs) inside this one.
</div>
Potential problem: could cause issues with stylesheets.
Option 2:
Calculate relative position based on reference element:
<div id="ID1">
<!--catcher-->
</div>
Height: 100px
<div id="ID2">
<!--catcher 2-->
</div>
Height: 200px
+100px from previous element
<div id="ID3">
<!--catcher 3-->
</div>
+100px + 200px from previous element
Problems: A lot of bookkeeping.
Option 3:
Have a look at code inside Q2W3:
https://wordpress.org/plugins/q2w3-fixed-widget/
Anyway I look forward to seeing what you come up with 🙂
Best regards,
Michael
Option 1: possible issues with Javascript, when scripts want to target parents/siblings. Adding a wrapping div around the sticky element will disrupt that.
Option 2: not really sure what you mean. Looks complex! 😉
Option 3: had a quick look. It gives me some ideas on how to handle it, but their methods are very different from what I have so far.
I do have an idea how I’m going to handle it. Making more than one element sticky is not so much the problem, what is really going to take a lot of time is how to do it nicely in the admin. For every element, I’d like to have independent options, and to make that clear and not confusing, will be the real challenge.
Thread Starter
mln83
(@mln83)
Hi mark,
Thanks for the quick response.
Yeah, I can understand that the admin side of things could be a bit of a pain. Some suggestions for the admin side:
Have a general Settings page where people can set up the basic constraints for the sticky element(s) like:
Space between top of page and sticky element.
Check for Admin Toolbar.
Do not stick element when screen smaller than: (optional) ?
Do not stick element when screen larger than: (optional) ?
Z-index: (optional) ?
Push-up element (optional): ?
Dynamic mode: ?
Debug mode: ?
Then Add a new tab called Element(s). Inside this tab have options for:
Sticky Element 1: * ? (required)
and then an ADD button below the sticky element where people can add a new element.
These are just some ideas. Thanks again for crafting this useful plugin 🙂
Best regards,
Michael