Note that there are some explanatory texts on larger screens.

plurals
  1. POShow certain Raphael shapes on click
    primarykey
    data
    text
    <p>There was a <a href="https://stackoverflow.com/questions/4180963/how-to-call-raphael-methods-on-jquery-objects">good answer</a> on how to call raphael methods on jquery objects. It works perfectly. But I need a bit more functionality. I want to show shapes width certain attributes on a button click. In that answer I could only affect all shapes in the array. How can I filter them? I used that piece of the code:</p> <pre><code>$("button").click(function() { $.each(cottages_array, function(i, c){ c.animate({fill: '#55bfe1', opacity: 1}, speed_anim_in); }); }); </code></pre> <p>I have attribute type for my shapes and I want to highlight shapes only with a certain type (type A for example). Inside the cycle I can fill different types with different colors, but I don't know how to apply any conditions to the click outside of the cycle using jQuery.</p> <pre><code>for (var j = 0; j &lt; obj.cottages.length; j++) { var obj_cottages = obj.cottages[j], my_path = canvas.path(obj_cottages.coords); my_path .attr({stroke: "none", fill: cottage_color_start, "fill-opacity": 0.8, opacity: 0, cursor: "pointer"}) .data('type', obj_cottages.type) if (obj_cottages.type == 'A') { my_path .attr({stroke: "none", fill: "#fff", "fill-opacity": 0.8, opacity: 0, cursor: "pointer"}) } </code></pre> <p>I've spent the whole day trying to figure out how to do it and I have no luck at all.</p> <p><a href="http://jsfiddle.net/Fionaa/5BYK6/" rel="nofollow noreferrer">http://jsfiddle.net/Fionaa/5BYK6/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload