briangonzalez / jquery.pep.js

👟 Pep, a lightweight plugin for kinetic drag on mobile/desktop
http://pep.briangonzalez.org
1.3k stars 178 forks source link

Is there a way to add position:absolute only when the object was tapped/clicked? #188

Closed PierBover closed 8 years ago

PierBover commented 8 years ago

Right now when using .pep() it adds position:absolute; to the object.

Is there a way to disable this and only add position absolute after the object was tapped?

Anaphase commented 8 years ago

From inspecting the source, I would say probably not. You could just attach the pep handler on first click? Something like this:

$('.target-element').one('click', function() {
  $(this).pep()
})
PierBover commented 8 years ago

Thanks @Anaphase

Why didn't I think of that?

I need more sleep...

aidan-doherty commented 8 years ago

Is there a method to stop pep on release e.g. check when it's being dragged and remove position absolute when the item is not being dragged ?

Anaphase commented 8 years ago

@aidan2129, I kinda doubt it, because then it wouldn't be positioned anymore so what's the point of dragging? There are the stop and rest callbacks, and I suppose you could call $.pep.unbind() in one of those.

aidan-doherty commented 8 years ago

Yeah i found another solution anyway was just had to write a check for the height of the object changing then set it thanks for that :)