1
perspective:400px; transform-style: preserve-3d; transform:translateX(-$drawerWidth); transition: #{$transition}; 
window.onload = addListeners(); function addListeners(){ document.getElementById('app').addEventListener('mousedown', mouseDown, false); window.addEventListener('mouseup', mouseUp, false); } function mouseUp() { window.removeEventListener('mousemove', divMove, true); } function mouseDown(e){ window.addEventListener('mousemove', divMove, true); } function divMove(e){ var div = document.getElementById('app'); div.style.position = 'relative'; div.style.left = e.clientX + 'px'; } 

I have a little bit of CSS and a little bit of JS as above. I am trying to drag and reveal a drawer. I want the dragging to not only track the app-canvas with the touches, but I also would like to see the navigation drawer dragging and opening out with the transform tracking 1:1 with the rest of the dragging of the app.

Thoughts? I know this is sort of hard to read so... When you drag a div, another div begin to play it's animations 1:1 with the dragging +1 or -1 along the x-axis.

2
  • 2
    fiddle please. jsfiddle.net Commented Feb 18, 2014 at 6:20
  • If you want to see the drag/transform happen in real time, you will need to use the mousemove event as well Commented Feb 18, 2014 at 8:55

1 Answer 1

1

If you're looking to control CSS animations with Javascript this is an excellent resource.

http://css-tricks.com/controlling-css-animations-transitions-javascript/

Without getting too deep into it the easiest way to go about this is to replace the css transform style with jQuery. Changing it on each mousemove to depict the change.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, I actually found this earlier today. I will update as I move towards a solution... IN JSFIDDLE!
Sure I'll be happy to help.
cool! I am really busy right now, but this is something that I am anxious to work with! Low-priority at the moment unfortunately:(

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.