Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <section lang="fr">
  <h1>Obfusquer les liens de façon accessible</h1>
  
  <!-- Chaque faux-lien qui deviendra un vrai lien doit avoir un attribut role="link" et tabindex="0". -->
  <p><a data-href="https://www.google.fr" tabindex="0" role="link">Google</a></p>

  <p><a data-href="https://fr.wikipedia.org" tabindex="0" role="link">Wikipédia</a></p>
</section>

<p>(<a href="https://www.lalutineduweb.fr/obfuscation-liens-seo-problemes-accessibilite/">Article détaillé sur l'obfuscation des liens et l'accessibilité à retrouver sur mon blog</a>)</p>

<hr>

<section lang="en">
  <h1>Obfuscate links in an accessible way</h1>
  
  <!-- Each fake link that will become a real link must have a role="link" and tabindex="0" attribute. -->
  
  <p><a data-href="https://www.google.com" tabindex="0" role="link">Google</a></p>

  <p><a data-href="https://wikipedia.org" tabindex="0" role="link">Wikipedia</a></p>
  
  <p>(<a href="https://www.lalutineduweb.fr/en/seo-links-obfuscation-accessibility-problems/">Detailed article on links obfuscation and accessibility available on my blog</a>)</p>
</section>
              
            
!

CSS

              
                /* 
* FR : Donnons un style de lien à nos faux-liens qui deviendront des liens.
* EN: Let's give a link style to our fake links that will become links.
*/
[role="link"] {
  text-decoration: underline;
  color: blue;
}
              
            
!

JS

              
                $(document).ready(function() {
  
  /**
   * FR : Récupérer tous les faux-liens.
   * EN: Get all fake links.
   */ 
  var link = $('[role="link"]');
  
  /**
   * FR : Fonction de transformation de l'attribut data-href en href.
   * EN: Function to transform the data-href attribute into href.
   */ 
  function transformHref(theLink){
      /**
       * FR : Récupérer la valeur de l'attribut data-href.
       * EN: Get the value of the data-href attribute.
       */
      var linkHref = theLink.attr('data-href');
      
      /**
       * FR : Transformer l'attribut data-href en href
       * EN: Transform the data-href attribute into href
       */
      theLink.removeAttr('data-href').attr('href', linkHref);
  }
  
  /**
   * FR : Exécuter la fonction au survol du document.
   * EN: Execute the function when hovering over the document.
   */
  $(document).hover(function() {
    link.each(function(){
      transformHref($(this));
    });
  });
  
  /**
   * FR : Exécuter la fonction au focus n'importe où dans le document.
   * EN: Execute the function when focusing anywhere in the document.
   */
  $(document).focusin(function() {
    link.each(function(){
      transformHref($(this));
    });
  });
  
  /**
   * FR : Exécuter la fonction au clic pour que les personnes pilotant à la voix puissent accéder au lien sans survol ni focus.
   * EN: Execute the function on click so that people using voice control can access the link without hovering or focusing.
   */
  link.each(function(){
    $(this).click(function() {
      transformHref($(this));
    });
  });
  
});
              
            
!
999px

Console