Giter Club home page Giter Club logo

sticky-sidebar's People

Contributors

abouolia avatar blazeu avatar geenkaas avatar janlucaklees avatar kugaevsky avatar matthewgross avatar tnottu 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  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

sticky-sidebar's Issues

Sticky bottom bug when the page refreshed at bottom

When the page refreshed at bottom, the sidebar will stick way above the container bottom line. It seems the problem is this sticky sidebar calculated the page dimension before the images loaded. So when the images loaded (images on content, because my images on sidebar have fixed dimension while the ones on content designed to be responsive) this will make the page getting taller and sticky sidebar stuck above the bottom. When the screen resized, sticky sidebar will recalculate the dimension and will work correctly.

Not that this is a big problem because people won't refresh page while at bottom page, but maybe this can be perfected.

Unexpected token export ln:696

Is it possible to support the ES6 features of this plugin using vanilla js? i.e. no package managers/compiler/polyfill?

Still not usable with npm

Some weeks ago I opened a PR that added the main attribute to the package.json pointing to src/sticky-sidebar.js. This way the package is usable with npm or similar package managers.

I now see that the value as changed to **dist**/stikcy-sidebar.js which renders it unusable with npm again.

The problem is, that only in the src/sticky-sidebar.js there is an export statement, exporting the StickySidbar class. This is crucial when you want to use it this package with require or import.

Please either set the attribute "main" in the package.json to src/sticky-sidebar.js again, or add an export statement to the dist/sticky-sidebar.js file.

Can't navigate via tab key to entire page

Hello,

While testing a site I am building that includes sticky-sidebar, I noticed that I have issues tabbing through the page. It seems that once the focus enters the object tag created by the plugin, it gets stuck.

Adding a tabindex of -1 to the object tag seems to fix it. Just one question, do you foresee any issues by adding this attribute to the object tag?

Thanks,
Josh

Bugs due to confusion between lowercase and uppercase "affixType"

  • stickyClass (default: 'is-affixed') never removes:

    if( 'static' === affixType )   //  <-----  affixType === 'STATIC'
       this.$sidebar.removeClass(this.options.stickyClass);
    else
       this.$sidebar.addClass(this.options.stickyClass);
  • affixEvent.type: "affix.STATIC.sticky", not "affix.static.sticky":

    var affixEvent = $.Event('affix.' + affixType.replace('viewport-', '') + StickySidebar.EVENT_KEY);

UglifyJS: Unexpected token: punc ()) - Webpack

Hi

I get this error when trying to minify sticky-sidebar through UglifyJS within Webpack 3.10.
Unexpected token: punc ())

I use this version of babel:
"babel-preset-env": "^1.6.1"

The error only occurs when importing sticky-sidebar:
import "sticky-sidebar";

UglifyJS settings:
new UglifyJSPlugin({ beautify: false, mangle: { screw_ie8: true, keep_fnames: true }, compress: { screw_ie8: true }, comments: false }),

Error:
ERROR in stickySidebar-302051997b86aa81111e.js from UglifyJs Unexpected token: punc ()) [stickySidebar-302051997b86aa81111e.js:154,24] Child extract-text-webpack-plugin ../node_modules/extract-text-webpack-plugin/dist ../node_modules/css-loader/index.js??ref--2-2!../node_modules/postcss-loader/lib/index.js??ref--2-3!../node_modules/resolve-url-loader/index.js!../node_modules/sass-loader/lib/loader.js??ref--2-5!sass/style.sass: 2 assets error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. make: *** [build-production] Error 1

Is this a known problem - or do I do something wrong here? :)

Jonas

Using sticky-sidebar and webpack

I am trying to use sticky-sidebar in my webpack setup but I run into the following error:

sticky-sidebar.js:8 Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0_jquery___default(...)(...).stickySidebar is not a function

I have the following js file:

import $ from 'jquery';

require('sticky-sidebar');

export default function() {
$('.s-sidebar').stickySidebar({
topSpacing: 60,
bottomSpacing: 60,
containerSelector: '.s-main',
innerWrapperSelector: '[data-sticky]',
});
}

Could it be that I am using the wrong version when calling require()? I installed the NPM package but I see three versions and I cannot select which one to use. I already have my own version of jQuery running (see first line) so I need a "clean" plugin.

Let me know if you are aware of this issue and if you have a solution or need more details on my setup.

EDIT: code is not formatting properly, removed.

NPM version behaves weirdly

Hi there, thanks for your great work! Could it be that the NPM version of the script needs updating? It behaves weirdly, elements are 'flickering'...

Production bundle needs work

Add the module name to the package.json because currently its missing and bundlers dont know what to do.

Please make it an UMD module. I can help you do this with Rollup for example, it will be quite easy actually as you dont have any dependencies.

Add minified version of the code.

Fails on IE11?

Apologies for not having more to go on at this stage, but something appears to be off on IE11. When I load examples/basic.html, I get no errors but the content disappears. (The error referenced in #21 fires when scrolling down the page, however.)

I'm not immediately able to see what's going on in the dev tools, but I suspect it might be related to the object. I'll investigate more tomorrow and add additional detail if I can find any.

destroy() doesn't work

If I use

var stickySidebar = new StickySidebar('#sidebar-container');
stickySidebar.destroy();

I get this error on browser console

Uncaught TypeError: this.removeEventListener is not a function
at StickySidebar.destroy (sticky-sidebar.js:722)
at theme.js:1288
at dispatch (jquery-1.11.1.min.js:3)
at r.handle (jquery-1.11.1.min.js:3)

Could you please check? Thanks!

destroy sticky bar in mobile view

I need to disable sticky bar in mobile view. (<=768px). how can I disable sticky bar? also it should work when resize the window. ex: on ipad in landscape mode should work side sticky bar and when rotate it to portrait mode sticky bar should be disable.

Thank you very much.

account for padding-top on body with fixed header

@abouolia In this issue you asked @kiwimind if there is a padding or margin on the body or html mine has padding-top: 58px on the body and the footer is not pushing the sticky sidebar at the right moment(the sticky sidebar is overlapping with the footer). How do you account for this kind of cases.

screen shot 2017-12-05 at 3 52 15 pm

Thank you in advance!

Update options after init

Is it possible to update options after init?

For example, the top spacing is set to 50 by default but I need to increase it to 100 when a custom event triggered in my page.

ie 11 issue

is there any fix for ie11? Sidebar isn't working at all. I'm getting white field over my content

Sidebar flickering or springing upon arriving at bottom or top

This flickering or springing just happens once each time the sidebar arrive to its top after it reach bottom side, vise versa. This only happens on Firefox, on Chrome it works fine. And on Firefox, if smooth scrolling enabled this bug is gone, but a lot of people disabling this smooth scroll.

Here's the screen capture https://youtu.be/G10Ls_NPCRA
Maybe seems unnoticeable on your demo, but on real site with pictures on sidebar it really bothering.

This happens when the position changed from relative to fixed, but Firefox not changing it on time, a litle bit delayed, causing it to springing. You can't see this bug when the dev tool open, you have to close it. Is there any way to fix this? Thanks

Edit:
My screencapture video on Youtube got removed, here's another video of it https://streamable.com/swlfu

Sidebar fits viewport method need to take top/Bottom spacing into the equation

Heys, first thanks for the awesome work on this!

Context

I detected a small bug on the calculation. In lookalike "scrollable example" my sidebar was bigger that viewport by just a few pixels and got cropped ( didn't scroll through and affix bottom)

So a viewport with 500px height, a sidebar with 499px height with a topSpacing of, for example 100px, doesn't produce the "scrollable effect", because isSidebarFitsViewport() returns true

Current and Expected behaviour

(expected after code editing)

gif

A Pen is available for testing. For this demo, just resize the window to something between 500px < x < 572px ( sidebar height + TopSpacing)

Fix

I didn't go through the entire codebase but, i assume that top and bottom spacing should be added to the equation depending on the this.scrollDirection.

/**
  * Determine whether the sidebar is bigger than viewport.
  * @public
  * @return {Boolean}
 */
isSidebarFitsViewport(){
let offset = this.scrollDirection === 'down' ? this.dimensions.lastBottomSpacing : this.dimensions.lastTopSpacing;

 return this.dimensions.sidebarHeight + offset < this.dimensions.viewportHeight;
}

Thanks once again!

How to apply only for desktop version (no mobile)

Hey there, thanks for your plugin.
I am using it successfully with the desktop version of my project, but now I'm having problems with the mobile version (implemented with bootstrap) since it shouldn't work due to the different nature of the scroll usage.

Any suggestion how to selectively show the sticky sidebar depending on screen resolution?
Thanks in advance.

NPM package 3.2.0 contains older version

I'm looking at version 3.2.0 of the NPM package for sticky-sidebar (currently at https://registry.npmjs.org/sticky-sidebar/-/sticky-sidebar-3.2.0.tgz) and I notice that the actual JavaScript files included are not version 3.2.0:

\src\sticky-sidebar.js is version 2.3.0
\dist\sticky-sidebar.js is version 2.3.0
\dist\jquery.sticky-sidebar.js is version 2.3.0

\dist\jquery.sticky-sidebar.min.js is version 2.2.0
\dist\sticky-sidebar.min.js is version 2.2.0

Is this intentional?

Sidebar to big for viewport

Hi,

First of all your plugin is amazing! works really smooth and happy i found it!

One question though, when my sidebar is bigger then the viewport is there any way for me not to scroll the sidebar up but keep it fixed top the top of the screen and "cut" off the bottom lets say.

Thanks

Need to update docs and correct slip in code

Thanks for great plugin, but seems the documentation is out of date. Also you have a slip in code (section "Plugin Definition"):

if (data[config] === undefined && ['destory', 'updateSticky'].indexOf(config) != -1) {
                    throw new Error('No method named "'+ config +'"');
                }

You have 'destory', but must be 'destroy'.

Negative top margin on sticky element

Hi,

Thanks for a great plugin, it's mostly working very well.

I'm hoping that there's going to be a straightforward way around what I'm trying to accomplish, but so far I've been unable to find one...

When I've got a sidebar with a negative top (or margin-top) value, to overlap a header element, I'm unable to get this to work as expected.

I can amend the code to add in the value of this negative top, amending the colliderTop and colliderBottom values to match, but I'm getting some weird overlapping issue with the footer not pushing the element up.

Is there something else I can check to get this working? I've been unable to find anything regarding offsetting margins or positioning amendments.

Thanks

Error in responsive

Hello, when I review the page in responsive size it continues to show how sticky, I think that responsive should not behave like this, any suggestions on how to solve this?

destroy and re-activate cause error!

I have add this code because when the window resized, the header navbar height changed.

$(window).on('resize', function() {
    console.log('window resize');
    $('.rd-sidebar').stickySidebar('destroy');
    $('.rd-sidebar').stickySidebar({
        containerSelector: '.rd-page-wrapper',
        innerWrapperSelector: '.rd-sidebar-inner',
        minWidth: 1000,
        resizeSensor: true,
        topSpacing: $('.rd-navbar').height(),
    });
});

When the window was resized the sticky menu destroyed successfully but when it re-activate, in the console window show me this.

TypeError: g.contentDocument is null sticky-sidebar.min.js:1:6965

Sticky only .sidebar__inner

Can i sticky only .sidebar__inner ?

Example:

<html>
	<body>
		<div id="main-content" class="main">
		    <div id="sidebar" class="sidebar">
		        
		        <div class="normal__content">
		            <!-- Content not sitcky goes here -->
		        </div>

		        <div class="sidebar__inner">
		            <!-- Content sitcky goes here -->
		        </div>
		        
		    </div>
		    <div id="content" class="content">
		        <!-- Content goes here -->
		    </div>
		</div>
	</body>
</html>

Mobile version

Hi Ahmed,

Maybe I do something wrong, but it seems like on mobile, sticky layer is always on the content. Is there any way to stop them for small displays?

Thank you.
Alexander

Tag a release in GitHub

Hey, great plugin.
I saw you have done a V2.0, good job!
Now please do a tag and a release on github. It really helps users when choosing a library to see versions and so on.
If you are not sure how, just ask.

Bug with removeResizeListener

The function doesn't work properly. $element.prop('resizeListeners') property is not removed.

 var index = resizeListeners.indexOf(callback);

is always -1.
Maybe it connected with not correct work of addResizerListener.

Sidebar Flickering Up and Down When It Reaches The Footer

I have a bottom margin on the body that is causing the sidebar to flicker up and down when it reaches the footer. The margin is necessary to give space to a sticky footer that is absolutely positioned. Can someone please help?

Can't "require" with browserify.

Hi!
Good lib, thanks!
But after npm install --save sticky-sidebar and putting require('sticky-sidebar'); in my code, gulp (on building project) says: cannot find module 'sticky-sidebar'.
I think, you need to put main directive to your package.json file.

Resize Sensor on Firefox and IE 11

Hi. Great plugin. I'm using sticky-sidebar.min.js.

Everything seems to be working fine in Chrome, except I'm experiencing a little scroll flicker as the .inner-wrapper-sticky div changes from fixed to relative when reaching the end of the container element.

On the latest version of Firefox (55.0.3), the resize sensor does not seem to be working properly. I went ahead and tested this on the basic example of the plugin - https://abouolia.github.io/sticky-sidebar/examples/basic.html. Upon adding content to the sidebar and scrolling to bottom of the page, the sidebar crosses over into the footer.

Also, in IE 11 (11.1593.14393.0), the console is showing a 'SCRIPT445: Object doesn't support this action' error, in regards to CustomEvent initialization.

Please advise. Thanks!

destroy() doesn't work correctly on IE11 or Edge

The destroy method doesn't seem to work quite correctly on IE or Edge. The instance doesn't get destroyed.

Version: 3.2.0

Steps to reproduce:

  1. Go to basic demo page with IE11 or Edge
  2. Scroll down a bit, so that the sticky column sticks and follows
  3. Open developer console and type a.destroy()
  4. Sticky column will unstick and go back to page top. Instance seems to be destroyed.
  5. Scroll back to the top.
  6. Scroll down again. Sticky column follows again, as if it was reinitialized.

Flickering when scrolling to bottom of page.

This issue only happens once in a while, but does seem to occur in all browsers. When scrolling to the bottom of the page, the fixed sidebar will sometimes flicker rapidly.

Here is a screencap of the issue. The sidebar actually flickers a lot faster than in that video, but I guess video couldn't capture it the speed.

I am using this plugin in conjunction with ResizeSensor.

It seems to be easier to recreate while dev tools/inspector is open. The issue is occurring on this site.

Any help on this would be much appreciated, thanks

Sticky Element doesn't resize when lazy loading images

When images are lazy loaded (loaded only when inside the viewport), neither resizeSensor nor using .updateSticky() causes the sticky element to update. If the window is resized, it then fixes itself.

Currently, you can see the issue here: http://test.travelalaska.com/Things%20To%20Do/Adventure.aspx

*Edit: see comment below. This link won't show the non-working version. *

Here's a screenshot from that page, where the images load after scrolling. I'm using updateSticky() on both of the right columns when any image is loaded. The resizeSensor element is the correct height, but the sticky elements are not sticking the full way down.

screen shot 2018-01-26 at 8 28 31 am

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.