JSFiddle - React, Tailwind, and code Playground
HTML
<a href="http://www.mywebsite.com/Scripts/xx.pdf">link1</a>
<a href="http://www.mywebsite.com/Scripts/xx1.pdf">link2</a>
CSS
* {margin: 0px; padding: 0px;}
body {background-color: rgb(248,248,248)}
#nav {
list-style:none;
}
#nav li {
float:left;
display:block;
width:100px;
position:relative;
z-index:500;
}
/* this is the parent menu */
#nav li a {
display:block;
padding:15px;
color:#000;
border: 1px solid transparent;
}
#nav li a:hover {
border: 1px solid black;
}
#nav a.open {
color:#fff;
background-color: pink;
}
#nav ul {
position:absolute;
display:none;
padding:0;
list-style:none;
}
#nav ul li {
width:100px;
float:left;
}
#nav ul a {
display:block;
height:15px;
padding: 15px;
color:#666;
}
#nav ul a:hover {
text-decoration:underline;
}
.active{
background-color: pink;
}
JavaScript
function RemoveBaseUrl(url) {
/*
* Replace base URL in given string, if it exists, and return the result.
*
* e.g. "http://localhost:8000/api/v1/blah/" becomes "/api/v1/blah/"
* "/api/v1/blah/" stays "/api/v1/blah/"
*/
var baseUrlPattern = /^https?:\/\/[a-z\:0-9.]+/;
var result = "";
var match = baseUrlPattern.exec(url);
if (match != null) {
result = match[0];
}
if (result.length > 0) {
url = url.replace(result, "");
}
return url;
}
$('a').attr('href',function(i,o){
return RemoveBaseUrl(o) ;
})