1
I need to load a "fake Download" when a link in the menu is triggered, but in this menu some links are empty <a href="javascript:;">
or <a href="#">
, need to identify only these via javascript and do not open the "Loader".
I cannot add anything in the menu (id, class, etc...).
$( "a" ).click(function() {
$( "#loader" ).fadeIn( "slow" );
});
#loader{ width: 100%; height:100%; display: none; background-color:rgba(255,255,255,0.6); position: fixed; top: 0; left: 0; z-index: 2 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="loader"><img src="images/loader.gif" width="100px" height="100px" style="margin-left: 45%; margin-top: 20%;" /></div>
<nav>
<ul>
<li><a href="#">Vazio 1</a> <- Não pode Funcionar</li>
<li><a href="javascript:;">Vazio 2</a> <- Não pode Funcionar</li>
<li><a href="linkcerto">Link correto</a></li>
</ul>
</nav>
The reason for the problem is the back-end developer of the site I’m touching has simply disappeared, so I can’t move the source code directly, only in java-script.
I don’t quite understand what you want to do. , but in your JS you’re taking the link to all the elements that have the <code>a</code> tag so it fires. Put an ID on the items and call the specific ID. ?
– user90217
I think it would be more interesting if you demonstrate (via code) the solution
– rLinhares
So, the problem is that I have no way to edit "html" because the back-end blocked the change of the files in ftp. I am only allowed to edit the ". js" and ". css". Other items that already have ID blocked, the links in question cannot add ID, class or any other element. For this reason I need to identify what has the mentioned urls and not activate the function.
– Rodrigo B. Silva
Rodrigo.There is no way to take this file from FTP, make the change and replace?
– user90217
It didn’t work. An important thing is that the words "empty 1" and "empty 2" are symbolic, the links are not real. , using your code would be kind of like this:
– Rodrigo B. Silva
$( "a" ).click(Function() { if (("a").val() != "#" || ("a").val() != "javascript:;") { $( "#Loader" ).fadein( "slow" ); } });
– Rodrigo B. Silva
Meso so did not work.
– Rodrigo B. Silva