1

I am coding my website, and a friend of mine was helping me. This code does not work on IE 10 (Windows 7). I even tried the legacy modes and to no avail. Upon clicking on "services" for example, this code would work on FF or Chrome. But, not on IE. Can someone help me fix this code so it would also work on IE?

$('#services-fr-2').on('click',function(){

    $(".clientsFr").hide();
    $('.servicesFr').fadeToggle();
    $('#green-pouch-fr').animate({
        'top':'450px'//,
        //'height':'450'
    });

});

EDIT: Here is the fiddle as requested.

http://jsfiddle.net/dVMT9/5/

EricLaw
  • 56,563
  • 7
  • 151
  • 196
Midevil Chaos
  • 279
  • 1
  • 3
  • 13
  • Any errors in console? – elclanrs Oct 20 '13 at 03:55
  • Semicolon at the end of the `on()` function? Sometimes IE can be picky about stuff like this. – Jace Cotton Oct 20 '13 at 03:56
  • No, none at all. @Jacedc, will try that – Midevil Chaos Oct 20 '13 at 03:56
  • Break it down line-by-line until you figure it out. Get rid of everything in the click callback. If it works, add those in one at a time until you break it. I highly doubt the problem is in the code you're showing here. – Brad Oct 20 '13 at 03:57
  • @MidevilChaos can you create a jsfiddle? That way all of us can try debugging the code. – Neeraj Oct 20 '13 at 04:00
  • 2
    Please describe what the actual error is - "this code does not work on IE 10" isn't descriptive enough to actually provide a good answer. What about it doesn't work? Do you get an error? This is probably a good time to introduce you to http://www.jslint.com/ as well. – Goyuix Oct 20 '13 at 04:17
  • Goyuix there is no error. JSlint picks up nothing except the regular $ error in relation to jslint (as it always does). All that should happen, does not happen. I tried every line one by one. But the JS code refuses to execute on IE. My rectangle should go down and adjust to the amount of text (in the fiddle the text won't appear, which is fine I suppose, since there are not separate html files to be used). – Midevil Chaos Oct 20 '13 at 04:35
  • For those interested, check the fiddle in the edited post :) – Midevil Chaos Oct 20 '13 at 04:36
  • Open developer tools on IE using F12 and see if the page is being rendered in quirks mode or some older compatibility – yuvi Oct 20 '13 at 06:30
  • I can't see any problem with [the fiddle](http://jsfiddle.net/5TJWY/) in IE10 (it works in a same way as in FF), just assign a jQuery library to your code... – Teemu Oct 20 '13 at 18:41
  • @ yuvi, tried that. But it changed nothing in terms of JS. – Midevil Chaos Oct 20 '13 at 23:02
  • @Teemu. If it works on FF and Chrome on my side, does that not indicate that I am using a library? Of course I am, although I took your advice and re-used it by changing library versions. Alas, to no avail. I even tried the jquery one itself. – Midevil Chaos Oct 20 '13 at 23:05
  • @MidevilChaos There's no jQuery library attached in the fiddle you've linked... – Teemu Oct 21 '13 at 04:01
  • -_- you could attach one in the fiddle? Oh. In any case, I always use the Google one (been taught that Google has a vast one). I use the latest. – Midevil Chaos Oct 21 '13 at 04:32

4 Answers4

0

You are missing brackets.

$('#services-fr-2').on('click',function(){  
        $( ".clientsFr" ).hide();
        $('.servicesFr').fadeToggle();
        $('#green-pouch-fr').animate({
            'top':'450px'//,
            //'height':'450'
        })
});
Neeraj
  • 8,408
  • 8
  • 41
  • 69
0

Your problem is the comma after 'top':'450px'

The comma would be fine if the next line wouldn't be commented out. Remove the comma and IE will be fine.

Steve
  • 8,609
  • 6
  • 40
  • 54
  • I commented the comma. I still removed it just now though just in case (IE might have been dumb here? But no, it wasn't). – Midevil Chaos Oct 20 '13 at 04:23
0

Could it be px in 'top':'450px', I once had a issue with px, just try removing them

Nuwan Dammika
  • 587
  • 9
  • 20
  • 1
    I wish it was that! How I wish it would be that simple. But sadly it isn't. Thank you for the advice though, will be useful in the future for certain. – Midevil Chaos Oct 20 '13 at 23:13
0

I faced same problem in IE9. I tried top without quotes and it worked.

Ashok
  • 1