I'm trying to accomplish a hover animation using JS, but my skills with said language are very limited. I have this script in my script.js file, as it is the only script I'm using:
$(document).ready(function() {
animationHover('#intro-logo' 'tada')
function animationHover(element, animation){
element = $(element);
element.hover(
function() {
element.addClass('animated ' + animation);
},
function(){
//wait for animation to finish before removing classes
window.setTimeout( function(){
element.removeClass('animated ' + animation);
}, 2000);
});
}
}
})();
The goal is that when I hover over #intro-logo, the script will add classes .animated and .tada which will animate the darn thing! However I get Uncaught SyntaxError: Unexpected string which brings me to
animationHover('#intro-logo' 'tada')
I don't know what I'm doing wrong, I used a tutorial here and it worked for the guy, but I'm having no such luck. I would sincerely appreciate anyone's help.
Thank you in advance, this community is amazing. This is my first question, but all of you guys have helped me solve hundreds of problems along my rocky way to web development prowess (much of which obviously still remains ahead).
Edit: I added the missing comma and now it seems there is a problem with the way I'm ending the document. Posted is my entire JS file, how to I properly close everything? })(); doesn't seem to work.
$(document).ready(function () {
animationHover('#intro-logo', 'tada')
function animationHover(element, animation) {
element = $(element);
element.hover(
function () {
element.addClass('animated ' + animation);
},
function () {
//wait for animation to finish before removing classes
window.setTimeout(function () {
element.removeClass('animated ' + animation);
}, 2000);
});
}
});
Removed unnecessary }
and ()
at the end, as well as added the comma.
I am trying to configure a custom context menu for jsTree. I want files to have two options [Rename, Delete] and I want folders to have one option [Create] The below code seems correct as described ...
I am trying to configure a custom context menu for jsTree. I want files to have two options [Rename, Delete] and I want folders to have one option [Create] The below code seems correct as described ...
I'm trying to see if I can do the following: Have some Javascript make a call to JavaFX. Have JavaFX then spawn a thread to do work it has been given from the Javascript. Come back to the Javascript ...
I'm trying to see if I can do the following: Have some Javascript make a call to JavaFX. Have JavaFX then spawn a thread to do work it has been given from the Javascript. Come back to the Javascript ...
I'm just curious that how can a .mov file play in a browser without any plug in support.I know that .mp4,.ogg and .webm filescan play without any plug in because the html5 video tag support them.but ...
I'm just curious that how can a .mov file play in a browser without any plug in support.I know that .mp4,.ogg and .webm filescan play without any plug in because the html5 video tag support them.but ...
I have this function: $(".insidediv").hide(); $(".floater").mouseenter(function(){ $(".hideimg").fadeOut(function(){ $(".insidediv").fadeIn(); }); }); $(".floater").mouseleave(...
I have this function: $(".insidediv").hide(); $(".floater").mouseenter(function(){ $(".hideimg").fadeOut(function(){ $(".insidediv").fadeIn(); }); }); $(".floater").mouseleave(...