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 9058479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:44:00+00:00 2026-06-16T14:44:00+00:00

Sorry If this seems short/ un-researched (I’ve probably been looking in all the wrong

  • 0

Sorry If this seems short/ un-researched (I’ve probably been looking in all the wrong places with the wrong logic in mind) but I feel like the answer is going to be simple/straight forward.

Say I have some variables set up, for example:

var path1 = paper.path("M 95, 259 L 110, 250... etc. etc.. ");

var path2 = paper.path("M 96 138 L 55, 100,... etc... etc..");

Insert them into a set…

var set1 = paper.set();
    set1.push(icon1, path1);

EDIT: These two steps x2 ^^^^^^^^^

Then want to go ahead and insert that new set into a new array with new objects with their own ids, So I can later reference that array when I set up a click handler function.

Basically is there any way I should/can go about attaching each set to this new array of new objects?

EDIT:

Here’s more specifically what I’m working with.. I created a for loop to run through that array… which works but it only displays the first switch DIV no matter which set is clicked. Instead I want to display switch2 when set2 is clicked… or even switch3 with set3.. etc. Thanks.

    switches = [
        { id: 'switch1', set: set1 },
        { id: 'switch2', set: set2 }

    ],
    current,
    max,
    i;


for (i = 0, max = switches.length; i < max; i++) {
    initSwitch(switches[i].set, switches[i].id);
}

function initSwitch(switchStr, targetId) {

        txElm = document.getElementById(targetId);

     var clickHandler2 = (function (e) {
         if (current) {
             if (current === txElm) {
                 return;
             }
             current.style.display = '';
         }
         current = txElm;
         current.style.display = 'block';
         //this.toFront();
         paper.safari();
    });

    set1.click( clickHandler2 );
    set2.click( clickHandler2 );

FINAL EDIT:

check out this jsfiddle I just wrote up. I want the first box and image to display the “switch1” Div and the second two boxes to display the “switch2” Divs.

http://jsfiddle.net/thecomplex/AEa2X/13/

  • 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-16T14:44:01+00:00Added an answer on June 16, 2026 at 2:44 pm
    var switches = [
            { id: 'switch1', set: set1 },
            { id: 'switch2', set: set2 }
    ];
    var current;
    
    for (var i = 0, max = switches.length; i < max; i++) {
        initSwitch(switches[i].set, switches[i].id);
    }
    
    function initSwitch(set, targetId) {
        var txElm = document.getElementById(targetId);
    
        set.click(function(e) {
            if(current == txElm)
                return;
            if(current)
                 current.style.display = '';
            current = txElm;
            current.style.display = 'block';
            paper.safari();
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this question seems a bit complex but I think its all related
Sorry if this question seems stupid, but it's stumped me for a couple days,
Sorry if this is a dupe. There are many similar questions but it seems
(I’m sorry if this has been asked before; the search feature seems to be
sorry if this all seem nooby and unclear, but I'm currently learning Netlogo to
This seems to be a stupid question since Java does short circuit, but I
Sorry if this seems like a silly question - I am an amateur when
Rather new to php, so sorry if this seems stupid. I'm really copying a
Sorry if my question seems dumb. I've started using Eclipse Ganymede 3.4 this week
Sorry for asking this again but ppl seem to connect csrf only with form

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.