jQuery not working in IE AHHH?

2019-06-24 00:12发布

问题:

My website I am making for a client is here : http://vicewebdesign.com/resonantlight_com/

It works perfectly in chrome and firefox but in IE non of the plugins (jquery) work, There are 3 diff jquery plug ins, the home page hre has a nivo slider not working in IE : http://vicewebdesign.com/resonantlight_com/

The tabify plugin foron this pag isnt working in IE :http://vicewebdesign.com/resonantlight_com/perl

and also on the same page the quovolver plug in isnt working.

I have searched this alot and all the ansers I find are specific to a plug in and my prblem is NONE of my jquery is working. I tried diff library code script like differnt versions and all and latest. But nothing working !

回答1:

The problem is that IE9 is now adhering to standards and this gives problems with plugins trying to circumvent the pre IE9 problems.

One possible solution is to force IE9 in IE8 standards mode with this meta tag:

 <meta http-equiv="X-UA-Compatible" content="IE=8"></meta> 

the other option is to fix the code:

most UI plugins reside on $.browser.msie to check if we are in IE but they don't check the version. In my case the solution (jquery.ui.checkbox.js) was to replace all $.browser.msie calls with this variable :

var isIEAndVersionIsLowerThan9 = $.browser.msie && (parseInt($.browser.version, 10) < 9);

This solution is better than adding the meta tag as it will enable all IE9 features.



回答2:

Try this this will works

<meta http-equiv="X-UA-Compatible" content="IE=8"></meta> 


回答3:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>jQuery from Microsoft AJAX CDN</title>
    </head>
    <body>

        <button id="btn">Show Message</button>

        <div id="message" style="display:none">

            <h1>Hello from jQuery!</h1>

        </div>

        <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>
        <script>
            // Fallback to loading jQuery from a local path if the CDN is unavailable
            (window.jQuery || document.write('<script src="/scripts/jquery-1.9.0.min.js"><\/script>'));
        </script>
        <script>

            function domReady() {
                $('#btn').click( showMessage );
            }

            function showMessage() {
                $('#message').fadeIn('slow');
            }

            $( domReady );

        </script>
    </body>
</html>