hello I’m trying to build a slider that changes the size of a text element using html but i’m unable to make a working html font size, I always have issue here is my code
$w('#text32').html= `<p style = "font-family:${font1},serif;font-size:"+${fontSize}+"px;text-align:center;"> ${$w('#input1').value}</p>`;
and
export function slider1_change(event) {
fontSize=$w("#slider1").value
}
i think the issue is in how i handled the variable in the html of the text32
Thanks you in advance !
J.D
July 15, 2019, 10:13am
2
You need to put the
$w('#text32').html= ...
inside the slider1_change() function (after you retrieve the new value.
Yeah i do know that, but what i am asking is how you put a variable for the fontsize, because what i do doesn’t work
J.D
July 16, 2019, 2:13pm
4
@jeuxgamerdu26 you should delete the + sign (before and after the variable)
J.D
July 16, 2019, 2:36pm
5
Something like:
$w("#text35").html =`<p style = 'font-family:${font1},serif;'><span style='font-size:${fontSize}px;'><span style='text-align:center;'> ${$w("#input1").value}</p>`;