Last active
May 15, 2017 09:55
-
-
Save danielpataki/df0e7215ca50adebc4cec6846689fc4c to your computer and use it in GitHub Desktop.
Microinteractions
This file contains 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
a { | |
color: #000; | |
display:inline-block; | |
text-decoration: none; | |
position: relative; | |
} | |
a::after { | |
height:2px; | |
position:absolute; | |
width:calc(100% - 11px); | |
content: attr(data-target); | |
text-indent: -9999px; | |
padding-left:11px; | |
line-height: 20px; | |
font-size:11px; | |
color: #fff; | |
background:#000; | |
left:0px; | |
top:100%; | |
transition: height 100ms linear | |
} | |
a:hover::after { | |
height:20px; | |
bottom:-20px; | |
text-indent: 0px; | |
} |
This file contains 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
This contains a <a class="flaglink" href='http://wikipedia.com'>link to an article</a>, isn't that great?! |
This file contains 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
var links = document.getElementsByClassName('flaglink') | |
for (i = 0; i < links.length; ++i) { | |
var url = links[i].getAttribute('href') | |
if (url.indexOf("://") > -1) { | |
hostname = url.split('/')[2]; | |
} | |
else { | |
hostname = url.split('/')[0]; | |
} | |
hostname = hostname.split(':')[0]; | |
links[i].setAttribute('data-target', hostname) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment