Jump to content
Search Community

Dragging when a div in front...

mimeartist test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I've got a draggable background, but it needs to have an transparent layer of small dots (which I'm using a transparent .png for) over the front that don't move... I know this isn't strictly a gsap issue... but is there a way to drag a div that is below a div you don't want to move?

Link to comment
Share on other sites

Hello mimeartist,

 

If I understand you correctly.. you want to make it so an element doesn't  accept any events? ..

 

You could do this with just CSS using pointer-events:

#element {
      pointer-events:none; // disable mouse events on element
}

pointer-events:none will stop the element from receiving any mouse events. Which in turn allows you to click through the element, and click the element below it.

 

pointer-events: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events

 

Let us know if this doesn't answer your question? :)

  • Like 1
Link to comment
Share on other sites

Yes awesome Jamie, but from that link it looks like IE11 supports it.. but your link got me thinking of the versions of IE that don't support it..  very long list :)

 

Try this JS pointer-events kludge for CSS pointer-events support in IE10 and below:

 

See the Pen BriCb by jonathan (@jonathan) on CodePen

 

Let me know if your able to still click through the red moving bar in IE10 and below when the checkbox is checked.

 

Thanks

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...