Code Monkey home page Code Monkey logo

sticksy's People

Contributors

kovart avatar steelkovalchuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sticksy's Issues

Dynamic topSpacing ?

Hi

Is it possible to change the topSpacing value "on-the-fly"? We have a responsive sticky header that changes height during scroll or resize (and at some point disappears completely) and a sidebar that has always the same distance to the header (or the top document border if the header is not visible). If we scroll, the sidebar pans with a spacing (like 50px) from the header that is 100px in height. So the sidebar should be positioned 150px from the top document border. If the header shrinks to 50px, the sidebar should be 100px from the top document. And if the header dissapears completely, the sidebar distance between document top and sidebar should be 50px. Is this possible with your sticky plugin? Can I overwrite the topSpacing value while the script is already running? Or does topSpacing support a dynamic function?

Problem partially solved with an accordion

Hi, i'm using your plugin on a woocommerce site to sticky the add to cart bar, it works quite good, but i've a problem.

This bar has an accordion inside it, when i open an accordio it goes on overflow and sticky container doesn't move, it update only if i scroll the page back up of about 200px, so i made this script to hardrefresh whene i click on an item in the widget.
it quite works, but obviously it refreshes after some time, so you can see an overflow then after half second it jumps up, obviously i can't hide this overflow cause the sticky element is in absolute position....

can you suggest something? or some bugfix directly to the plugin?
thanks a lot

var stickyEl = new Sticksy('.js-sticky-widget', {
topSpacing: 85,
listen: true
})
stickyEl.onStateChanged = function (state) {
if(state === 'fixed') stickyEl.nodeRef.classList.add('widget--sticky')
else stickyEl.nodeRef.classList.remove('widget--sticky')
}

let timeOut;
jQuery('.js-sticky-widget *').click(function () {
console.log('click');
clearTimeout(timeOut);
timeOut = setTimeout(function () {
console.log('refresh');
stickyEl.hardRefresh();
}, 700)
});

image

Collapse (bootstrap) inside sticky element

We have a similar problem as #10 with a collapse (bootstrap) inside a sticky element.
Since the height is a fixed style property on the sticky element which only updates after the collapse is finished we get this jump in height all of a sudden. Is there a way to fix this?

You can find a recording of whats happening in the attachment.

Screen.Recording.2023-10-25.at.13.29.54.mov

Window resize listener?

Tried

$(window).on('load resize orientationchange', function () {
	if (window.matchMedia("(min-width: 768px)").matches) {
		var stickyEl = new Sticksy('.s-cont > .sticky');
		stickyEl.hardRefresh()
	}else{
		Sticksy.disableAll(); ///seems do not clean the markup
	}
});

But after that i see a LOT of sticksy hidden nodes and element mispositioned till the page reload.

How to refresh state after window resize and clear the markup when sticky functionality is not needed?

Снимок экрана 2021-05-21 в 15 39 33

Enable/disable with jQuery

Hi, thanks for the plugin, it's really great.

I was wondering if you can tell me how to enable and disable with jquery? I want to disable on smaller screen size (mobile).

$('.sticky-element').sticksy({
    topSpacing: 20,
    listen: true
});

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.