Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
Rangy : how to implement Multiple style?

im using Rangy for highlighting text in my web page. is there a way to set multiple styles for user to choose for highlighting text ? for example when user click on some yellow highlight, i take all of the text with getHighlightForElement() method but i dont know how to change the color class/id ? or any other way suggestion? thank you !

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The code below is a simple stylesheet swapper. When you click on the "Highlight 1" button, it will load a stylesheet named "highlight1.css". The stylesheet will be swapped out when you click a different button.

<html lang="en">
  <head>
    <link href="default_highlight.css" rel="stylesheet" type="text/css" id="highlight">
    <script>
      function setHighlight1() {
        const highlight = document.getElementById('highlight');
        highlight.href = 'highlight1';
      }
      function setHighlight2() {
        const highlight = document.getElementById('highlight');
        highlight.href = 'highlight2';
      }
      function setHighlight3() {
        const highlight = document.getElementById('highlight');
        highlight.href = 'highlight_3.css';
      }
    </script>
  </head>
  <body>
    <button onclick="setHighlight1()">Highlight 1</button>
    <button onclick="setHighlight2()">Highlight 2</button>
    <button onclick="setHighlight3()">Highlight 3</button>
  </body>
</html>

Hopefully this answers your question.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda