javascript - Function wont call inside a jquery .click() -


trying call function inside .click event. know .click working because of console.log. not sure why function wont work. have tried other solutions such onclick() in html no luck.

here links clicked on:

<h2 class="logo child"></h2>     <ul>     <li><a href="#web" class="nav-link">developer</a></li>     <li><a href="#design" class="nav-link">designer</a></li>     <li><a href="#film" class="nav-link">film</a></li>     <li><a href="#portfolio" class="nav-link">portfolio</a></li>     <li><a href="#about" class="nav-link">about</a></li> </ul> 

here javascript

$(document).ready(function(){    function spinlogo()     {         $('.logo').css({             'transition' : '1.5s ease-in-out',             'transform' : 'rotate(360deg)'         });     } settimeout(function(){     spinlogo(); }, 1000)  $('.nav-link').click(function()     {         spinlogo();     }); }); 

i call function when page loads , works without problem.

edit

i added logo code.

put transition in .logo class definition, , transform in separate class, , add class name logo element when .nav-link clicked. can remove class after timeout.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -