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

mimic move for new elements #48

Open
redgriffith opened this issue Aug 31, 2021 · 2 comments
Open

mimic move for new elements #48

redgriffith opened this issue Aug 31, 2021 · 2 comments

Comments

@redgriffith
Copy link

redgriffith commented Aug 31, 2021

Hello,

I see that we can mimic move with this option
each: {
move: true,
}

the problem is that it seems to work only with existing elements.
-> When i add a new element on the scene and move it, mimic with others existing elements not working.
We saw it on your example with thoses two yellow rectangle http://jsfiddle.net/nichollascarter/qgwzch0v/

My idea is to create a function like this -> if i move a draggable element (i can know that with your onmove function) then move all elements with class ".draggable" which have also specific class (for example ".mimic").

Add and remove the .mimic class will be easier for me, i can do it.
...But my real problem is how can i use your code in subjx.dev to call a mimic function ??

Thanks in advance !

@redgriffith redgriffith changed the title mimic move for added form mimic move for new elements Aug 31, 2021
@nichollascarter
Copy link
Owner

Hi @redgriffith

Did you see this example?

const observable = subjx.createObservable();
subjx('.draggable').drag({...}, observable);

const createDraggableAndSubscribe = e => {
    subjx(e.target).drag({...}, observable);
};

You should use external observable instance if you want to add new element.

@redgriffith
Copy link
Author

Hello Thanks for you reply,
i think it's what i searched for

Nevertheless i tried combinations on your example fiddle but don't succeed with yellow rectangle ?

i don't understand how to use it correctly ^^;

thanks

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

2 participants