Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8013891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:45:47+00:00 2026-06-04T19:45:47+00:00

I have a problem to remove last path cloned. I want, when I click

  • 0

I have a problem to remove last path cloned.
I want, when I click on one path that its clone appears and when I click on another path, the last path cloned disappears or animates scale to the original to remove it and another one created. Can someone show me how do that?

My code :

var paper = Raphael("paper", 1000, 1000);

var mg = {};

mg.rg1a = this.paper.path("..." ).initZoom();
mg.rg2a = this.paper.path("..." ).initZoom();
mg.rg3a = this.paper.path("..." ).initZoom();


for (var state in mg) {

mg[state].setAttr({
      fill:           "#c7c6c5",
      stroke:         "#CFCFCF",
      "stroke-width": 1
    });



   (function (st, state) {
st[0].style.cursor = "pointer";

mg[state].click(function(){

                             var temp = mg[state].clone();
           temp.animate({'transform':"s2 2"}, 500);
           temp.setAttr({
      fill:           "#FF6600",
      stroke:         "#FFFB00",
      "stroke-width": 1 });


    });



})(mg[state], state);

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:45:49+00:00Added an answer on June 4, 2026 at 7:45 pm

    I can solve this for you, but I’m not sure that’d be helpful.

    You’ve made a couple of errors in the fiddle that will need to be fixed before you can tackle your problem.

    1 Raphael doesn’t have a function called setAttr(). It does have a function called attr().

    [2] You’re using transforms to scale your clone. Transforms came in in Raphael 2.0, but your fiddle is using raphael 1.5.2. Probably you just set it up incorrectly, but I thought I’d point it out.

    To fix your particular issue is very simple. You just need to hold onto a reference to the clone you created. Every time you click on something, check if the reference points to an object. if it does, then remove it using .remove(). This way you’ll nuke the old clone just before you create the new one.

    If you’re really stuck, reply and I’ll give you the working version of your fiddle I’ve created. Give it a go first though.

    N.

    PS. firebug and webdeveloper are two browser extensions you should use if you’re not doing it already. It takes the guessing out of a lot of errors.


    since you asked nicely, here’s your modified fiddle. I’ve added a variable called cloneHolder. Whenever you click, you check to see if cloneHolder refers to anything, and if it does, you remove it using cloneHolder.remove(). You could change the code to animate your clone disappearing before you remove it if you like.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that works great, but I have one small problem. I
I have a problem where I need to remove all code and triggers from
I only have this problem in chrome. How remove the border around the image?
I have a path of points that represent the outline of a polygon. The
last_tag=abcde x; last_tag = last_tag.replace(/[\s]+x$/, ''); this is my problem: i have to remove
I have run into a problem while writing C++ code that needs to compile
How to remove path related problems in python? For e.g. I have a module
Okay I have spent the last 2 days trying to sort this one out.
Ok, i have input object, when it is changed it adds another one.. also
i have problem use link_to_remote link_to_remote document example say link_to_remote Delete this post, :update

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.