How can I hide part of javascript from IE

This is my javascript function to open the jquery dialog.

   ('#dialog').append(iframe).appendTo("body").dialog({
          autoOpen: false,
          modal: true,
          resizable: false,
          show: 'slide',        
          width: 800,       
          height: 700,        
         close: function() {           
    }   
});             
$('#dialog_click').click("callback",function() {            
   $('#dialog').dialog('open');                 
   return false;
}); 

How to hide part show: 'slide,from IE?

+5
source share
6 answers
var options = {
          autoOpen: false,
          modal: true,
          resizable: false,       
          width: 800,       
          height: 700,        
         close: function() {           
    }   
};
if ( ! $.browser.msie){
  options ['show'] = 'slide';
}

$('#dialog').append(iframe).appendTo("body").dialog(options);  
+2
source

try it

if ( ! $.browser.msie){
  $( "#dialog" ).dialog( "option", "show", "slide" )
} 
+2
source
$('#dialog').append(iframe).appendTo("body").dialog({
          autoOpen: false,
          modal: true,
          resizable: false,       
          width: 800,       
          height: 700,        
         close: function() {           
    } 
});

if(!$.browser.msie) {
     $( "#dialog" ).dialog( "option", "show", "slide" );
}
+2

jquery jQuery.browser.msie >= 1.9

var opts = {
    autoOpen : false,
    modal : true,
    resizable : false,
    show : 'slide',
    width : 800,
    height : 700,
    close : function() {
    }
};
if (!/msie/.test(window.navigator.userAgent)) {
    opts.show = 'slide';
}

('#dialog').append(iframe).appendTo("body").dialog(opts);
$('#dialog_click').click("callback", function() {
    $('#dialog').dialog('open');
    return false;
});
+2

( script, ..), , , : javascript IE.

:

   ('#dialog').append(iframe).appendTo("body").dialog({
          autoOpen: false,
          modal: true,
          resizable: false,

        /*@cc_on @*/
        /*@if (true)

        @else @*/
          show: 'slide',        
        /*@end @*/

          width: 800,       
          height: 700,        
         close: function() {           
    }   
});             
$('#dialog_click').click("callback",function() {            
   $('#dialog').dialog('open');                 
   return false;
}); 

IE show: 'slide',, non-IE Conditional Compilation Statements, () else.

+2

, .

First there are conditional comments, i.e.

<!--[if !IE ]>
    <script>
       $('#dialog').append(iframe).appendTo("body").dialog({
         autoOpen: false,
         modal: true,
         resizable: false,
         show: 'slide',        
         width: 800,       
         height: 700,        
         close: function() {           
         }   
       });             
       $('#dialog_click').click("callback",function() {            
         $('#dialog').dialog('open');                 
         return false; 
       }); 
    </script>
<![endif]-->

Or you can check the jquery browser variable as other guys point out.

Also, if you go this way, and you really want to target the old version of IE, you can use some functions specific to it (for example, attachEvent)

0
source

All Articles