Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
flow561

Draggable + isotope / masonry

Recommended Posts

Hi there !

Starting to get some fun with GSAP !

 

I'm trying to create an infinite draggable gallery. For this, i started by creating an Isotope grid.

 

Now i want to add the GSAP Draggable plugin but nothing is moving. Draggable creates an intermediate div in my Isotope grid and i think that's what actually break everything. Any idea to fix this ?

 

Thanks for your help :)

See the Pen EQOeVd by florentsimon (@florentsimon) on CodePen

Link to post
Share on other sites

Hi @flow561 :)

 

Welcome to the forum and thanks for joining Club GreenSock.

 

I'm not at all familiar with isotope.js, but it looks like everything in your layout is clickable <a> tags. By default Draggable will ignore clicks on <a> tags. You'd have to set dragClickables:true in your project to drag everything around. I'm not sure that's what you'll want as I'm guessing each of those img elements will be clickable in your final project, but that's what's preventing Draggable from doing anything in your pen. From the docs:

  • dragClickables:  Boolean - By default, Draggable will ignore clicks on <a>, <input> <select>,<button>, and <textarea> elements (as well as any element that has a data-clickable="true"attribute), allowing the browser's default behavior (like clicking on an input would give it focus and drop the cursor there to begin typing), but if you want Draggable to hijack those clicks and initiate dragging instead, set dragClickables:true.

More info in the docs:

https://greensock.com/docs/Utilities/Draggable

 

I also noticed you had throwProps set to true in your demo, but that script was missing. Here's the CodePen link for it:

 

<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/ThrowPropsPlugin.min.js"></script>

 

Hopefully that helps a bit. Happy tweening and welcome aboard.

:)

 

 

  • Like 4
Link to post
Share on other sites

I'm not really familiar with isotope grids. In addition to what PointC suggested you may want to study the following demo from @OSUblake

 

See the Pen RNLdpz by osublake (@osublake) on CodePen

 

I think he may have a post somewhere where he goes into some the details or an updated version, but hopefully its a start.

 

 

 

 

  • Like 4
Link to post
Share on other sites

Thanks for your answers @PointC @Carl !

 

11 hours ago, PointC said:

You'd have to set dragClickables:true in your project to drag everything around

 

That's true! Now this is working like a charm ! Thanks :):):)

 

For information, i don't use Draggable to reorder thumbs like in your demo @Carl, I'm trying to reproduce this gallery from Poignée de Main Virile: http://fubiz.studio/projects , sorry for being poorly expressed

 

I don't know if i'm actually using draggable in the good way or not ... :?

 

[Update] Codepen edited :)

 

Link to post
Share on other sites

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.

×