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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:18:59+00:00 2026-06-06T06:18:59+00:00

The current state As from my link you can pick different regions on the

  • 0

The current state

As from my link you can pick different regions on the map and everything seems to be working until you re-select a county you have selected before. Data values stored with each path decide if it isSelected or notSelected. I have no problem in changing the element data just clicked with this but I can’t find a way of storing the last element selected in a way that I can change it’s element data. Which means I first have to click on the previous county to set it’s element data to notSelected

First I define var currentcountyselected = "";. This allows me to store the paths[arr[this.id]].name;. When I click on a new path I can make the last path fill change with $('#'+currentcountyselected).attr({fill: attributes.fill});

In Raphael’s for loop I set obj.data('selected', 'notSelected'); so all path elements are set to notSeelected.

So what I need is some way to store the last path so I can change it’s element data

This is the click function cleaned up from live example.

obj.click(function(){
if(this.data('selected') == 'notSelected')
    {this.animate({fill: '#698B22'  }, 300);                
    this.data('selected', 'isSelected');
    $('#'+currentcountyselected).attr({fill: attributes.fill}); 
    paths[arr[this.id]].value = "isSelected";
    currentcountyselected = paths[arr[this.id]].name;
    }
else
    {this.animate({fill: '#32CD32'}, 300);                  
    paths[arr[this.id]].value = "notSelected"; /* set path value*/
    this.data('selected', 'notSelected');                       
    }   
});/* end mark selections */

I’ve been working on this project for a while and the client now wants the interface to work differently. This has really ate up my hourse.


EDIT:
Although I have found a solution by simply taking out the if/else I would still like to know how to get at element data in a previous path (or any path for that matter).

  • 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-06T06:19:01+00:00Added an answer on June 6, 2026 at 6:19 am

    Here is my solution, posted as it might help someone. The link in my question has problems with click happy users.


    Globals

    var previouscountyselected = "Mayo"; /* default start, can be any county(path) */
    var start = true;
    var past = null;
    

    Changed code

    obj.click(function(){
    if(paths[arr[this.id]].value == 'notSelected')
        {
        this.animate({fill: '#698B22'}, 200);
        paths[previouscountyselected].value = "notSelected";
        paths[arr[this.id]].value = "isSelected";
        previouscountyselected = paths[arr[this.id]].name;
    
        if (!start && past != this)
            {
                past.animate({ fill: '#fff' }, 200);
            }
        past = this;
        start = false;                  
    }
    else if(paths[arr[this.id]].value == 'isSelected')
    {
        this.animate({fill: '#32CD32'}, 200);
        paths[arr[this.id]].value = "notSelected"; /* set path value */ 
    }
    });
    

    Overview
    if (!start && past != this) is a little unusual and is required or animated fades get messed up and choppy. The fade is not triggered if it is the first time a path is clicked and if you just hammer clicks on one path it doesn’t fade to white. The main if/else handles the actual control value.
    Until I get a jsfiddle up this link will demonstrate the desired behaviour.


    Note! the drop menu in this link does not work.

    Click happy friendly

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

Sidebar

Related Questions

Is there a way to view the diff's of my current working state with
I have to get the current Mute state from the following registry values as
How do I revert from my current state to a snapshot made on a
For GUI purposes I need by current state of state machine to enumerate possible
I want to write a ViewModel that always knows the current state of some
Lets say that you have a business object whose current state implies that there
I am trying to connect to the database and get current state of a
I try to collect some information about the current state of the CWInterface(connected bssid,
In the documentation for MKReverseGeocoder, the administrativeArea property gives you the current state the
How do you detect the current SCAN state and revert it after changing it?

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.