Matt
Matt

Reputation: 172

jquery - .animate doesn't work in IE

I've got some script:

$(window).load(function(){
$("#kontakt_kontakt").hover(
    function(){
       $("#kontakt").animate({left: '',bottom: '+=60'}, 440); 
    }, 
    function(){
       $("#kontakt").animate({left: '',bottom: '-=60'}, 440);  
    });

});

On hover it makes the img go few pxs up. Working perfectly in chrome but doesn't really work in IE - just nothing happens. Anyone one got a clue how to solve it? You can check it here: http://kafior.mydevil.net/index.html

Upvotes: 1

Views: 700

Answers (4)

voigtan
voigtan

Reputation: 9031

you have this error:

TypeError: element.dispatchEvent is not a function

element.dispatchEvent(event);

in your prototype.js file, you are including a couple versions of jQuery and prototype and both of those frameworks are using $, you need to look into the noConflict method in jQuery, and you really should try to remove as many versions of jQuery you can, there is no real reason you need to download 2-3 versions of jQuery.

Upvotes: 3

Guffa
Guffa

Reputation: 700342

It works in IE too, but your images are in the way.

If you point in the page above the menu, the images move. If you point on the images they won't move, because the elements having the hover events is behind the images, and the hover event apparently doesn't bubble through the images in IE.

Upvotes: 0

andyb
andyb

Reputation: 43823

There is a JavaScript error on the page, if you press F12 and then select the Console tab.

The error is occurring because the page includes two different JavaScript frameworks - prototype and jQuery which both define the $ function. See Using JQuery and Prototype in the same page for how to run them both together by using the jQuery .noConflict() function.

Also, you should look at optimising the jQuery and <script> tags, there is a lot of duplicated code that could be combined in a single event handle function.

Upvotes: 0

SpaceBeers
SpaceBeers

Reputation: 13947

You have this error:

SCRIPT438: Object doesn't support property or method 'dispatchEvent'

Here:

 if (document.createEvent) {
    element.dispatchEvent(event);
 } else {
    element.fireEvent(event.eventType, event);
 }

You're using jQuery AND Prototype on the same page from the looks of things. You need to run jquery noConflict mode.

jQuery.noConflict();

Add this line to the top of your jQuery code.

Upvotes: 1

Related Questions