I recently implemented some JavaScript code to add a sliding animation effect to the login form that appears with an accompanying picture.
After testing the code on JS Fiddle, everything worked perfectly. However, upon copying and pasting the same code into Chrome or Internet Explorer, nothing seems to be happening.
Both browsers have JavaScript enabled, so I'm not sure why it's not functioning correctly.
Below is the HTML snippet:
<body>
<header>
<div class="Header">
<nav id="navi">
<img src="http://www.bilder-upload.eu/upload/79a9ee-1471738072.png" class="logo"/>
<img src="C:\Users\Hasaan\Desktop\HasaanNEW\Hasaan\Media\Images\menu-icon.png" class="menu-icon"/>
<ul>
<li> <a class="navlinks" href="#">Home</a> </li>
<li> <a class="navlinks" href="#">About us</a> </li>
<li> <a class="navlinks" href="#">Our Services</a> </li>
<li class="last" id="login"> <a href="#">Login</a>
<div class="dummy">
<ul>
<li class="loginform"> <form method="post" action="">
<p><input type="text" name="login" value="" placeholder="Username or Email"></p>
<p><input type="password" name="password" value="" placeholder="Password"></p>
<p class="remember_me">
<label>
<label>
<input type="checkbox" name="remember_me" id="remember_me">
Remember me on this computer
</label>
</label>
</p>
<p class="submit"><input type="submit" name="commit" value="Login"></p>
</form>
</li>
</ul>
</div>
</li>
</ul>
</li>
</nav>
</div>
</header>
</body>
</html>
CSS:
@import 'https://fonts.googleapis.com/css?family=Montserrat';
@import 'https://fonts.googleapis.com/css?family=Roboto+Slab';
body {
margin: 0;
background: #808080 ;
font-family: "Montserrat", Helvetica, Arial, sans-serif;
color: #fff;
}
.show {
display: none;
}
...
... (Remaining CSS code)
...
And finally, the JavaScript function:
$(".last").on('click', function() {
$('li div ul').toggle('');
});
$('.nav > li div ul li a').click(function(e) {
e.stopPropagation();
});
For better understanding and testing, please refer to the following link of the working version in JS Fiddle: