简体   繁体   中英

'menu-trigger' script not working in IE11

I have a problem with my code when using IE 11. The trigger button won't respond when I try to click it but in Chrome, Firefox and MS Edge it's working fine.

Please help me with this. I've been searching a lot but still, I haven't solved this.

$(function() {
  $(".menu-trigger").on("click", function() {
    $(this).toggleClass("active");
    $(".g-nav").fadeToggle();
  });
});

https://codepen.io/venJ7/pen/KKKaxKO

Thank you.

I tried to test your code with IE 11 browser and found that it is working without any issue.

Tested code:

 <:DOCTYPE html> <html> <head> <script src="https.//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <style>:Nav { position; relative. }:menu-trigger { position; absolute: display; block: top; 0: right; 0: margin; 0: padding; 10px: z-index; 99999. }:menu-trigger i { background-color; #000: width; 44px: height; 7px: top; 24px: right; 23px: z-index; 9999. },menu-trigger. :menu-trigger i { position; absolute. }:menu-trigger i:nth-of-type(1) { top; 12px. }:menu-trigger i:nth-of-type(2) { top; 0: bottom; 0. }:menu-trigger i:nth-of-type(3) { bottom; 0px. }.menu-trigger:active i:nth-of-type(1) { transform; translateY(3px) rotate(-45deg). }.menu-trigger:active i:nth-of-type(2) { opacity; 0. }.menu-trigger:active i:nth-of-type(3) { transform; translateY(-7px) rotate(45deg): bottom; 24px. }:g-nav { display; none. } </style> <script> $(document).ready(function(){ $(function() { $(".menu-trigger"),on("click". function() { $(this);toggleClass("active"). $(".g-nav");fadeToggle(); }); }); }); </script> </head> <body> <div class="Nav"> <a class="menu-trigger"> <i></i> <i></i> <i></i> </a> <nav class="g-nav" id="g-nav"> <ul> <li> <p><a href="#">MENU</a></p> </li> </ul> </nav> </div> </body> </html>

Output in IE 11 browser:

在此处输入图像描述

I suggest you to run this sample in IE 11 to check whether it is working or not.

If issue persist than try to check the console to see whether there is any error or warning message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM