const hotspots = [{
top: (90* scaleToWidth),
left: (680* scaleToWidth),
radius: 10,
fill: 'rgba(0, 159, 227, 0)',
id: 'cirkel1',
hoverCursor: 'pointer',
selectable: false,
imgtop: 71,
imgleft: 236,
imgheight: 335,
imgwidth: 514,
placement: 'bottom',
tooltipid: 'cirkel1',
imgUrl: 'https://website.nl/new/cms/images/canvas/woonkamer/gordijnen.jpg'
},
];
Ik wil deze twee waardes:
top: (90* scaleToWidth),
left: (680* scaleToWidth),
Aanpassen adhv van een if else statement, dus dat probeer ik zo:
const hotspots = [{
if(window.outerWidth > 991) {
top: (90* scaleToWidth),
left: (680* scaleToWidth),
}else{
top: (250* scaleToWidth),
left: (680* scaleToWidth),
}
radius: 10,
fill: 'rgba(0, 159, 227, 0)',
id: 'cirkel1',
hoverCursor: 'pointer',
selectable: false,
imgtop: 71,
imgleft: 236,
imgheight: 335,
imgwidth: 514,
placement: 'bottom',
tooltipid: 'cirkel1',
imgUrl: 'https://website.nl/new/cms/images/canvas/woonkamer/gordijnen.jpg'
},
];
Maar hiermee krijg ik: Unexpected token '.'
Hoe kan zoiets?