I applied the following code to change the color of text when the mouse is hovering over it.
$w.onReady(function () {
$w(‘#text1’).onMouseIn(()=>{hoverTxt();});
$w(‘#text1’).onMouseOut(()=>{unhoverText();});
});
function hoverTxt(){
let oldHtmlStr = $w(‘#text1’).html;
let newHtmlStr = oldHtmlStr.replace(/#E0760D/i, ‘#402858’);
console.log(newHtmlStr);
$w(‘#text1’).html = newHtmlStr;
}
function unhoverText(){
let oldHtmlStr = $w(‘#text1’).html;
let newHtmlStr = oldHtmlStr.replace(/#402858/i, ‘#E0760D’);
console.log(newHtmlStr);
$w(‘#text1’).html = newHtmlStr;
}
This code completely works, but seems to interfere with Wix’s built in Text Link tool. I’m not sure if the code may be interfering somehow with the Link tool, but the hyperlink functions only without the hover code running. Looking for someone with more coding experience than me to help point out something I may be missing!