I am trying to create the floor plans of an apartment building as a SVG using Illustrator. The end goal is to use it on a website with a table next to it, where each row has some details about the individual apartments and when hovering over the row, the respective apartment in the SVG graphic highlights with changing its fill to a specific color. (an example would be this: https://the-jay.ch/wohnungen when you scroll down to 'wohnungsangebot')
I am fine with the coding part about the animation but one thing I struggle in illustrator, is to assign my own classes to the paths or groups of the floor plans I am designing. From my own research it is not possible in Illustrator to add my own classes.
The issue I have is that all apartments will have the same styling in terms of fill and stroke. Because of that reason, they all get assigned the same class. This is an issue for the jquery part later, because I will need to select each apartment individually to create the hover animation.
Of course I could add my own classes later on when I exported the SVG but that would also mean that I would have to re-add these classes every time when I need to make a change to the SVG graphic.
So my question is: is there a way to determine that each group or path in illustrator gets their own individual classes?
I know that by naming the layers, I can assign IDs but this doesn't help much because the styling is stored in the class that illustrator assigns and additionally, some of my 'apartments' are built out of multiple paths that would all get their own ID as an ID needs to be unique. But I need to target with my jquery the entire apartment not just one part of the apartment
To some extend you might define class names by using named graphic styles.
But this might not be extremely feasible.
As a workaround you could write some helperfunction in js, that will add classnames according to your AI object IDS.
Example of a naming scheme for AI layers:
In the above example I'm using double hyphens to seperate multiple id substrings.
Auto Class name function:
function setAutoClassNames(svg){
const elements = svg.querySelectorAll('[id]');
if(elements.length){
elements.forEach(function(el,i){
let id = el.id;
let idArr = id.split('--');
let firstID = idArr[0];
let idPrefix = firstID.replace(/[0-9]/g, '');
//optional: add classnames for certain types
if(idPrefix==='a'){
idArr.push('appartment');
}
//add classname prefix for elements of same type e.g floors, appartments
el.classList.add(idPrefix);
el.classList.add(firstID);
if(idArr.length>1){
let newClassNames = idArr.join(' ');
el.classList.add(...idArr);
}
})
}
}
<g id="floor2--floor-special">
will become
<g id="floor2--floor-special" class="floor floor2 floor-special">
All floor layers will both have a generic .floor and a unique .floorX class. (Same principle for appartments).
Example usage
const svg = document.querySelector('svg');
setAutoClassNames(svg);
function setAutoClassNames(svg) {
const elements = svg.querySelectorAll('[id]');
if (elements.length) {
elements.forEach(function(el, i) {
let id = el.id;
let idArr = id.split('--');
let firstID = idArr[0];
let idPrefix = firstID.replace(/[0-9]/g, '');
//optional: add classnames for certain types
if (idPrefix === 'a') {
idArr.push('appartment');
}
//add classname prefix for elements of same type e.g floors, appartments
el.classList.add(idPrefix);
el.classList.add(firstID);
if (idArr.length > 1) {
let newClassNames = idArr.join(' ');
el.classList.add(...idArr);
}
})
}
}
/**
* usage example
*/
// remove svg stylesheet to use own rules
const svgCss = svg.querySelector('style');
svgCss.remove();
//example show current selection
const pInfo = document.querySelector('.p-info');
let appartments = svg.querySelectorAll('.a');
appartments.forEach(function(appartment, i) {
appartment.addEventListener('click', function(e) {
let currentA = e.currentTarget;
let floor = currentA.closest('.floor');
// get floor/appartment number by id
let appNum = appartment.id.replaceAll('a', '');
let floorNum = floor.id.replaceAll('floor', '');
currentA.classList.toggle('a-active');
pInfo.innerHTML = `<span class="span-app">Appartment: ${appNum}</span>; <span class="span-floor">Floor: ${floorNum}</span>`;
});
});
.st0 {
fill: #FFFFFF;
stroke: #000000;
stroke-linecap: round;
stroke-linejoin: round;
stroke-miterlimit: 10;
}
.st1 {
fill: #FFFFFF;
}
.a-active {
fill: red!important;
}
.h-active {
fill: green!important;
}
.open {
fill: green;
}
<svg version="1.1" id="SvgjsSvg1006" xmlns:svgjs="http://svgjs.com/svgjs" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="404.5px" height="125.9px" viewBox="219.7 278.3 404.5 125.9" style="enable-background:new 219.7 278.3 404.5 125.9;"
xml:space="preserve">
<style type="text/css">
<![CDATA[
.st0{fill:#FFFFFF;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.st1{fill:#FFFFFF;}
]]>
</style>
<g id="floor2--floor-special" transform="matrix(1,0,0,1,0,0)">
<polygon id="open21" class="st1" points="575.8,326.6 552,318.4 546.5,325.4 495.4,307.9 494.4,309.1 493,308.7 492.9,308.6
492.1,308.4 491.4,308.1 490.6,307.9 489.8,307.7 489,307.4 488.2,307.2 487.5,307 486.6,306.8 485.8,306.6 485,306.4 484.2,306.2
483.4,306 482.6,305.8 481.8,305.7 481,305.5 480.1,305.3 479.3,305.1 478.5,305 477.7,304.8 476.8,304.7 476,304.6 475.7,304.5
474.9,304.4 473.2,304.1 471.5,303.9 469.8,303.7 468.1,303.5 466.8,303.4 466.7,298 465.8,298 464,297.9 462.3,297.8 460.5,297.7
458.7,297.7 456.9,297.7 455.1,297.7 453.4,297.7 451.6,297.8 449.8,297.8 448,297.9 446.2,298 444.8,298.2 444.8,302.6 444,302.7
442.2,302.9 440.6,303.1 438.8,303.4 437.2,303.6 435.5,303.9 433.8,304.2 432.1,304.6 430.5,304.9 428.9,305.2 427.4,305.6
425.7,306 424.1,306.5 422.6,306.9 421,307.4 419.5,307.9 417.9,308.4 416.7,308.9 415.4,309.3 413.8,307.4 313.1,343.6
308.8,338.3 271.1,351.8 275.5,357.2 251.1,366 230.6,373.4 230.6,382.4 234.3,387 234.3,377.9 254.9,370.5 254.9,370.5
285.3,359.6 287,361.5 287.5,361.3 306.3,354.6 304.7,352.6 316.9,348.2 316.9,348.2 326.6,344.7 326.6,344.7 417.6,311.9
430.9,328.4 431.6,329.2 432.6,330.4 432.6,336.8 432.8,336.7 434,336.3 435.2,335.9 436.4,335.5 437.6,335.2 438.9,334.9
440.2,334.6 441.5,334.3 442.8,334 444.1,333.8 445.4,333.6 446.7,333.4 448,333.3 449.4,333.1 450.7,333 452.1,332.9 453.4,332.9
454.7,332.8 456.1,332.8 457.4,332.8 458.8,332.8 460.2,332.9 461.5,332.9 462.8,333 464.2,333.2 465.5,333.3 466.8,333.5
468.2,333.7 469.4,333.9 470.7,334.1 472,334.4 473.3,334.7 474.6,335 475.3,335.2 475.3,333.8 475.9,333.1 477.1,331.5
478.4,329.9 479.5,328.3 480.1,327.5 491.9,312.5 546.7,331.3 546.3,331.9 559.2,336.3 565.9,327.7 565.9,327.7 570,329.1
573.8,330.4 573.8,330.4 577.6,331.8 580.4,328.2 "/>
<polygon id="a201" class="st1" points="417.6,311.9 394.4,320.3 409.4,338.7 409.4,347.8 432.6,339.5 432.6,330.4 "/>
<polygon id="a202" class="st1" points="394.4,320.3 378.9,325.9 393.9,344.3 393.9,353.4 409.4,347.8 409.4,338.7 "/>
<polygon id="a203" class="st1" points="378.9,325.9 363.4,331.5 378.4,349.9 378.4,359 393.9,353.4 393.9,344.3 "/>
<polygon id="a204" class="st1" points="363.4,331.5 347.9,337 362.9,355.5 362.9,364.6 378.4,359 378.4,349.9 "/>
<polygon id="a205" class="st1" points="347.9,337 332.3,342.6 347.3,361.1 347.3,370.2 362.9,364.6 362.9,355.5 "/>
<polygon id="a206" class="st1" points="332.3,342.6 326.6,344.7 326.6,344.7 316.9,348.2 331.9,366.7 331.9,375.7 347.3,370.2
347.3,361.1 "/>
<polygon id="a207" class="st1" points="316.9,348.2 304.7,352.6 306.3,354.6 287.5,361.3 300.8,377.8 300.8,386.9 331.9,375.7
331.9,366.7 "/>
<polygon id="a208" class="st1" points="290.3,364.7 287.5,361.3 287,361.5 285.3,359.6 270.3,364.9 285.3,383.4 285.3,392.5
300.8,386.9 300.8,377.8 "/>
<polygon id="a209" class="st1" points="270.3,364.9 254.9,370.5 269.9,389 269.9,398 285.3,392.5 285.3,383.4 "/>
<polygon id="a210" class="st1" points="254.9,370.5 234.3,377.9 234.3,387 239,392.8 243.7,391.1 254,403.8 269.9,398 269.9,389
"/>
<polygon id="a211" class="st1" points="236.1,347.6 220.3,353.3 220.3,362.3 225.9,369.2 225.9,376.6 230.6,382.4 230.6,373.4
251.1,366 "/>
<polyline id="a212" class="st1" points="236.1,347.6 251.7,342 266.6,360.4 251.1,366 236.1,347.6 "/>
<polyline id="a213" class="st1" points="251.7,342 298.2,325.2 308.8,338.3 271.1,351.8 275.5,357.2 266.6,360.4 251.7,342 "/>
<polyline id="a214" class="st1" points="313.7,319.6 328.7,338.1 313.1,343.6 308.8,338.3 298.2,325.2 313.7,319.6 "/>
<polyline id="a215" class="st1" points="329.2,314 344.2,332.5 328.7,338.1 313.7,319.6 329.2,314 "/>
<polyline id="a216" class="st1" points="329.2,314 344.7,308.5 359.6,326.9 344.2,332.5 329.2,314 "/>
<polyline id="a217" class="st1" points="344.7,308.5 360.2,302.9 375.2,321.3 359.6,326.9 344.7,308.5 "/>
<polyline id="a218" class="st1" points="375.7,297.3 390.7,315.7 375.2,321.3 360.2,302.9 375.7,297.3 "/>
<polyline id="a219" class="st1" points="375.7,297.3 398.9,288.9 413.8,307.4 390.7,315.7 375.7,297.3 "/>
<polyline id="a220" class="st1" points="398.9,288.9 399.2,288.8 401.1,288.2 402.9,287.5 404.7,286.9 406.6,286.3 408.4,285.8
410.4,285.2 412.2,284.7 414.1,284.2 416.1,283.7 418,283.2 420,282.8 421.9,282.4 423.9,282 425.9,281.7 427.9,281.3 429.9,281
431.9,280.7 433.9,280.4 435.9,280.2 438,279.9 440,279.7 441,279.7 445.2,298.1 444.8,298.2 444.8,302.6 444,302.7 442.3,302.9
440.6,303.1 438.9,303.4 437.2,303.6 435.5,303.9 433.9,304.2 432.2,304.5 430.6,304.9 428.9,305.2 427.4,305.6 425.7,306
424.1,306.5 422.6,306.9 421,307.4 419.5,307.9 417.9,308.4 416.7,308.9 415.4,309.3 413.8,307.4 398.9,288.9 "/>
<polyline id="a221" class="st1" points="441,279.7 442.3,279.6 444.3,279.4 446.4,279.3 448.4,279.2 450.5,279.1 452.5,279
454.6,279 456.6,279 458.7,279 460.7,279 462.8,279.1 464.8,279.2 466.9,279.3 468.9,279.4 471,279.6 473,279.7 475,279.9
477.1,280.2 479.1,280.4 481.1,280.7 483.1,280.9 484.1,281.1 475.7,304.5 474.9,304.4 473.2,304.1 471.5,303.9 469.8,303.7
468.1,303.5 466.8,303.4 466.7,298 465.8,298 464,297.9 462.3,297.8 460.5,297.7 458.7,297.7 456.9,297.7 455.1,297.7 455.1,297.7
453.4,297.7 451.6,297.8 449.8,297.8 448,297.9 446.2,298 445.2,298.1 441,279.7 "/>
<polyline id="a222" class="st1" points="475.7,304.5 484.1,281.1 485.2,281.3 487.2,281.7 489.2,282 491.1,282.4 493.1,282.8
495,283.2 497,283.7 498.9,284.2 500.8,284.7 502.7,285.2 504.6,285.7 506.5,286.3 508.3,286.9 510.1,287.5 511.1,287.8
519.4,290.7 503.8,310.7 495.4,307.9 494.4,309.1 493.7,308.9 492.1,308.4 490.6,307.9 489,307.4 487.4,307 485.8,306.6
484.2,306.2 482.6,305.8 480.9,305.5 479.3,305.1 477.6,304.8 476,304.6 475.7,304.5 "/>
<polyline id="a223" class="st1" points="519.4,290.7 535,296.1 519.5,316.1 503.8,310.7 519.4,290.7 "/>
<polyline id="a224" class="st1" points="535,296.1 550.8,301.4 535.2,321.5 519.5,316.1 535,296.1 "/>
<polyline id="a225" class="st1" points="550.8,301.4 586,313.6 575.8,326.6 552,318.4 546.5,325.4 535.2,321.5 550.8,301.4 "/>
<polygon id="a226" class="st1" points="586,313.6 575.8,326.6 580.4,328.2 577.6,331.8 583,333.6 589.5,341.5 589.5,350.6
601.5,346.3 601.5,343.6 623.7,335.6 623.7,326.5 "/>
<polygon id="a227" class="st1" points="583,333.6 573.8,330.4 573.8,330.4 570,329.1 565.9,327.7 559.2,336.3 556.2,335.3
554.5,334.7 547.7,343.4 549,352.8 549,361.8 549.7,361.8 551.1,361.6 552.5,361.5 553.9,361.3 555.3,361.2 556.6,361 558,360.8
559.3,360.5 560.7,360.2 562,359.9 563.4,359.6 564.6,359.3 565.9,358.9 567.2,358.5 568.5,358.1 569.8,357.7 570.1,357.6
578.2,354.6 589.5,350.6 589.5,341.5 "/>
<polygon id="a228" class="st1" points="554.5,334.7 546.3,331.9 546.7,331.3 531.6,326.1 515,347.5 515,356.6 518.9,357.9
519.5,358.1 520.8,358.5 522,358.9 523.3,359.2 524.6,359.6 525.9,359.9 527.2,360.2 528.5,360.5 529.9,360.7 531.2,361
532.6,361.2 533.9,361.3 535.3,361.5 536.7,361.6 538.1,361.8 539.4,361.8 540.8,361.9 542.2,362 543.6,362 545,362 546.4,361.9
547.7,361.9 549,361.8 549,352.8 547.7,343.4 "/>
<polygon id="a229" class="st1" points="515.9,320.7 499.3,342.1 499.3,351.1 515,356.6 515,347.5 531.6,326.1 "/>
<polygon id="a230--specialClass" class="st1" points="491.9,312.5 475.3,333.8 475.3,342.9 499.3,351.1 499.3,342.1 515.9,320.7
"/>
<path id="OG2" class="st0" d="M623.8,326.5L623.8,326.5L623.8,326.5C623.8,326.5,623.7,326.5,623.8,326.5
C623.7,326.5,623.7,326.5,623.8,326.5C623.7,326.5,623.7,326.5,623.8,326.5C623.7,326.5,623.7,326.5,623.8,326.5L623.8,326.5
l-37.8-13l-35.2-12.1l-15.7-5.4l-15.7-5.4l-8.3-2.9l-0.9-0.3l0,0l0,0l-1.8-0.6l0,0l0,0l-1.9-0.6l0,0l0,0l-1.9-0.6l0,0l0,0l-1.9-0.5
l0,0l0,0l-1.9-0.5l0,0l0,0l-1.9-0.5l0,0l0,0l-1.9-0.5l0,0l0,0l-1.9-0.4l0,0l0,0l-2-0.4l0,0l0,0l-2-0.4l0,0l0,0l-2-0.4l0,0l0,0
l-2-0.4l0,0l0,0l-2-0.3l0,0l0,0l-1.1-0.2l-1-0.1l0,0l0,0l-2-0.3l0,0l0,0l-2-0.3l0,0l0,0l-2-0.2l0,0l0,0l-2-0.2l0,0l0,0l-2-0.2l0,0
l0,0l-2.1-0.2l0,0l0,0l-2.1-0.1l0,0l0,0l-2.1-0.1l0,0l0,0l-2.1-0.1l0,0l0,0l-2.1-0.1l0,0l0,0l-2.1,0l0,0l0,0l-2.1,0l0,0h-2.1l0,0
l0,0h-2.1l0,0l-2.1,0l0,0l-2.1,0l0,0l0,0l-2.1,0.1l0,0l0,0l-2.1,0.1l0,0l0,0l-2.1,0.1l0,0l0,0l-2.1,0.1l0,0l0,0l-1.2,0.1l-1,0.1
l0,0l0,0l-2,0.2l0,0l0,0l-2,0.2l0,0l0,0l-2,0.2l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l35.1,12.1l-10.1,13L552,318.3z M535.1,321.5l-15.6-5.4l15.5-20l15.6,5.4L535.1,321.5z M519.5,316l-15.6-5.4l15.5-20
l15.6,5.4L519.5,316z M398.9,289l14.9,18.3l-23.1,8.3l-14.9-18.3L398.9,289z M375.7,297.4l14.9,18.3l-15.4,5.6l-14.9-18.3
L375.7,297.4z M360.2,302.9l14.9,18.3l-15.4,5.6l-14.9-18.3L360.2,302.9z M344.7,308.5l14.9,18.3l-15.4,5.6l-14.9-18.3L344.7,308.5
z M329.1,314.1l14.9,18.3l-15.4,5.6l-14.9-18.3L329.1,314.1z M313.7,319.7l14.9,18.3l-15.4,5.6l-4.4-5.4l-10.5-13L313.7,319.7z
M298.2,325.3l10.5,12.9l-37.6,13.6l0,0l0,0l0,0l0,0l0,0l0,0l0,0l0,0l4.3,5.3l-8.7,3.1l-14.9-18.3L298.2,325.3z M251.7,342
l14.9,18.3l-15.4,5.6l-14.9-18.3L251.7,342z M225.9,367.8l4.6,5.7v8.9l-4.6-5.7V367.8z M230.7,373.6l3.6,4.4v8.9l-3.6-4.4V373.6z
M331.9,366.6L317,348.2l15.4-5.6l14.9,18.3L331.9,366.6z M347.4,361l-14.9-18.3l15.4-5.6l14.9,18.3L347.4,361z M362.9,355.4
L348,337.1l15.4-5.6l14.9,18.3L362.9,355.4z M378.4,349.9l-14.9-18.3l15.4-5.6l14.9,18.3L378.4,349.9z M393.9,344.2L379,325.9
l15.4-5.6l14.9,18.3L393.9,344.2z M316.8,348.3l14.9,18.3l-30.9,11.1l-10.6-13l-2.7-3.4l18.8-6.8l0,0l0,0l0,0l0,0l0,0l0,0l0,0l0,0
l-1.6-1.9L316.8,348.3z M286.9,361.6C286.9,361.6,286.9,361.6,286.9,361.6C287,361.6,287,361.6,286.9,361.6l0.5-0.2l2.7,3.4
l10.5,13l-15.4,5.6l-14.9-18.3l14.8-5.4L286.9,361.6z M254,394.6L243.8,382l0,0l0,0l0,0l0,0l0,0l0,0l0,0l-4.6,1.7l-4.6-5.7
l20.4-7.3l14.9,18.3L254,394.6z M269.9,388.9L255,370.6l15.4-5.6l14.9,18.3L269.9,388.9z M234.4,378.1l4.6,5.7v8.9l-4.6-5.7V378.1z
M239.1,383.8l4.5-1.6v9l-4.5,1.6V383.8z M243.8,382.2l10.2,12.5v8.9l-10.2-12.5V382.2z M254.1,394.7l15.8-5.7v8.9l-15.8,5.7V394.7
z M269.9,389l15.4-5.6v9l-15.4,5.6V389z M285.4,383.4l15.4-5.6v9l-15.4,5.6V383.4z M300.9,377.9l30.9-11.1v9l-30.9,11.1V377.9z
M331.9,366.7l15.4-5.6v9l-15.4,5.6V366.7L331.9,366.7z M347.4,361.1l15.4-5.6v9l-15.4,5.6V361.1L347.4,361.1z M362.9,355.6
l15.4-5.6v9l-15.4,5.6V355.6z M378.4,349.9l15.4-5.6v9l-15.4,5.6V349.9L378.4,349.9z M393.9,344.3l15.4-5.6v9l-15.4,5.6V344.3z
M409.4,338.8l23.1-8.3v9l-23.1,8.3V338.8z M409.4,338.6l-14.9-18.3l23.1-8.3l13.3,16.3l1.6,2L409.4,338.6z M583,333.6l6.4,7.9
l-11.2,4l-8.1,2.9l0,0l-0.3,0.1l0,0l-1.2,0.4l0,0l-1.2,0.4l0,0l-1.3,0.4l0,0l-1.3,0.4l0,0l-1.3,0.3l-1.3,0.3l0,0l-1.3,0.3l0,0
l-1.3,0.3l-1.3,0.2l0,0l-1.3,0.2l0,0l-1.4,0.2l0,0l-1.4,0.2l0,0l-1.4,0.1l0,0l-1.4,0.1l0,0l-1.4,0.1l0,0l-0.6,0l-1.2-9.2l6.7-8.7
l1.7,0.6l3,1.1l0,0h0l6.7-8.6l7.8,2.7l0,0l3.9,1.3L583,333.6z M547.7,352.8L547.7,352.8l-1.4,0l0,0l-1.4,0l0,0h-1.4h-1.4l0,0
l-1.4,0l0,0l-1.4,0l0,0l-1.4-0.1l0,0l-1.4-0.1l0,0l-1.4-0.1l0,0l-1.3-0.1l0,0l-1.3-0.2l0,0l-1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l0,0l0,0
l-1.2,0.4l0,0l0,0l-0.1,0v-6.3l0,0l0,0l0,0l0,0l-1.6-2l0.6-0.2l0,0l1.2-0.4l0,0l1.2-0.4l0,0l1.2-0.4l0,0l1.2-0.4l0,0l1.2-0.3l0,0
l1.2-0.3l0,0l1.3-0.3l0,0l1.3-0.3l1.3-0.2l0,0l1.3-0.2l0,0l1.3-0.2l0,0l1.3-0.2l0,0l1.3-0.1l0,0l1.3-0.1l0,0l1.3-0.1l0,0l1.3-0.1
l0,0l1.3,0l0,0l1.3,0l0,0h1.3h1.3l0,0l1.3,0l0,0l1.3,0l0,0l1.3,0.1l0,0l1.3,0.1l0,0l1.3,0.1l0,0l1.3,0.1l0,0l1.3,0.1l0,0l1.3,0.2
l0,0l1.3,0.2l0,0l1.3,0.2l0,0l1.3,0.2l0,0l1.3,0.3l0,0l1.2,0.3l1.2,0.3l0,0l1.2,0.3l0,0l1.2,0.4l0,0l1.2,0.4l0,0l0.5,0.2l-4.8,6.2
l0,0l0,0l0,0l0,0v1.2L474.6,334.9z M601.5,337.2L601.5,337.2L601.5,337.2C601.5,337.2,601.5,337.2,601.5,337.2l-1.6-2l23.8-8.6v9
l-22.1,7.9V337.2L601.5,337.2z"/>
</g>
</svg>
Since AI won't strip ids when resaving the svg you can retain all class names.
However, you need to find a proper naming scheme to get the desired selectors.