2013-05-09 2 views
0

У меня проблема с jCrop. Он funcuina в других браузерах, но не работает в IE8. Я не могу найти проблему. Если это проблема с данными изображения или размером изображения, который не позволяет обрезать. Может кто-нибудь помочь?Jcrop IE8 не работает

<script type="text/javascript"> 

    jQuery(document).ready(function() { 

    // Create variables (in this scope) to hold the API and image size 
     var jcrop_api, boundx, boundy; 
     var $targetImage = jQuery('.targetImage'), targetImageDOM = $targetImage[0]; 

     var carregarJcrop = function() { 
      $targetImage.Jcrop({ 
      onChange: updatePreview, 
      onSelect: updatePreview, 
      aspectRatio: 1 
      }, function() { 
    // Use the API to get the real image size 
      var bounds = this.getBounds(); 
      boundx = bounds[0]; 
      boundy = bounds[1]; 
     // Store the API in the jcrop_api variable 
      jcrop_api = this; 
       }); 
      function updatePreview(c) { 
      if (parseInt(c.w) > 0) { 

       var rx = 231/c.w; 
       var ry = 231/c.h; 

       jQuery('#x').val(c.x); 
       jQuery('#y').val(c.y); 
       jQuery('#w').val(c.w); 
       jQuery('#h').val(c.h); 



      jQuery('.jcrop-preview').css({ 
       width: Math.round(rx * boundx) + 'px', 
       height: Math.round(ry * boundy) + 'px', 
       marginLeft: '-' + Math.round(rx * c.x) + 'px', 
       marginTop: '-' + Math.round(ry * c.y) + 'px' 
                }); 
               } 
              }; 
             }; 

       var checaCarregamento = function() { 
        if (targetImageDOM.complete) { 
         carregarJcrop() 
        } else { 
        setTimeout(checaCarregamento, 500); 
        } 
        }; 

        if ($targetImage.length > 0) 
         setTimeout(checaCarregamento, 500); 
         }); 

ответ

0

Вы используете самую последнюю версию? Кажется, есть исправление IE8:

IE 8 Fix

Смежные вопросы