Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applies Position relative on init if the element is fixed positioned #60

Closed
ahmed1490 opened this issue Aug 11, 2014 · 9 comments
Closed

Comments

@ahmed1490
Copy link

In _create we have..

  // set relative positioning
  var style = getStyle( this.element );
  if ( style.position !== 'relative' && style.position !== 'absolute' ) {
    this.element.style.position = 'relative';
  }
@desandro
Copy link
Owner

You can overwrite the position of the container with containerStyle

@tiagomsmagalhaes
Copy link

Hi...

It was really weird to find this as a solution for draggabilly, when in the website this option is absent. It makes me think that there are another options for draggabilly...

@suhaotian
Copy link

what abput fixed position style?

@z1haze
Copy link

z1haze commented Sep 4, 2017

@desandro the link you shared for this was related to masonry.. when i tried the same option with draggabilly, nothing happened

@desandro
Copy link
Owner

desandro commented Sep 6, 2017

This issue was fixed in v2.1.1. See #134

@z1haze
Copy link

z1haze commented Sep 6, 2017 via email

@z1haze
Copy link

z1haze commented Sep 6, 2017

please see this, by default if the element is styled with position absolute it forces them to be relative. why is this?

// css position values that don't need to be set
var positionValues = {
  relative: true,
  absolute: true,
  fixed: true
};

proto._create = function() {

  // properties
  this.position = {};
  this._getPosition();

  this.startPoint = { x: 0, y: 0 };
  this.dragPoint = { x: 0, y: 0 };

  this.startPosition = extend( {}, this.position );

  // set relative positioning
  var style = getComputedStyle( this.element );
  if ( !positionValues[ style.position ] ) {
    this.element.style.position = 'relative';
  }

  this.enable();
  this.setHandles();

};

@desandro
Copy link
Owner

desandro commented Sep 6, 2017

I'm not able to reproduce that bug. See demo https://codepen.io/desandro/pen/ac004626de5f69410b880d4bd215e2f8/

@z1haze
Copy link

z1haze commented Sep 6, 2017

Yea, i can't seem to cause it now either - I must have had an issue somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants