Created
September 24, 2018 03:17
-
-
Save luisfelipe-dev/ab18547b7a583cbe5a0d534c3e2dee09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>TESTE</title> | |
| <style> | |
| .tooltip { | |
| position: absolute; | |
| top: 0px; | |
| } | |
| .tooltip.left { | |
| left: -100px; | |
| } | |
| .tooltip.right { | |
| right: -100px; | |
| } | |
| .tooltip.mobile { | |
| left: 0px; | |
| } | |
| .caixa { | |
| position: relative; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="tooltip"> | |
| <p>teste</p> | |
| </div> | |
| <div class="caixa" data-position="left"> | |
| <p>teste1</p> | |
| </div> | |
| <div class="caixa" data-position="right"> | |
| <p>teste2</p> | |
| </div> | |
| <div class="caixa" data-position="left"> | |
| <p>teste3</p> | |
| </div> | |
| <div class="caixa" data-position="right"> | |
| <p>teste4</p> | |
| </div> | |
| <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" | |
| crossorigin="anonymous"></script> | |
| <script> | |
| $('.caixa').on('hover', function () { | |
| $('.tooltip').addClass('active' + $(this).data('position') + ($(window).width() < 900 ? 'mobile' : '')); | |
| }, function () { | |
| $('.tooltip').removeClass('active left right mobile'); | |
| }) | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment