scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
874 stars 305 forks source link

Images become very small when used inside a Foundation modal #190

Open yasar88 opened 8 years ago

yasar88 commented 8 years ago

Hi i am using cropit plugin inside a foundation modal.when i load big images ,the images become very tiny in the preview area. couldn't figure out why it is happening ,plz help me.

 <!DOCTYPE html>
   <html class="no-js" lang="en" >
      <head>
         <title>Foundation 4</title>
         <link rel="stylesheet" href="css/foundation.css">
         <style>
            .cropit-preview {
               width:400px;
               height:300px;
            }
         </style>
         <script src="js/vendor/custom.modernizr.js"></script>
      </head>
      <body>

       <div id="myModal" class="reveal-modal" >
          <div class="image-editor">
               <input type="file" class="cropit-image-input">
               <div class="cropit-preview"></div>
               <div class="image-size-label">
                 Resize image
               </div>
               <input type="range" class="cropit-image-zoom-input">

               <button class="export">Export</button>
          </div> 
           <a class="close-reveal-modal">&#215;</a>  
       </div>

         <a href="#" id="click" >Click Me For A Modal</a>

         <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
         <script src="js/foundation.min.js"></script>
         <script src="jquery.cropit.js" ></script>
         <script>
            $('#click').on('click',function(){
               $('#myModal').foundation('reveal','open');
               $('.image-editor').cropit({
                    imageState: {
                      src: 'http://lorempixel.com/500/400/',
                    }                  
               });
            });
            $('.close-reveal-modal').on('click',function(){
               $('#myModal').foundation('reveal','close');
            });
         </script>
      </body>
   </html>
![crop it](https://cloud.githubusercontent.com/assets/17021188/15540795/ed537e4e-22a6-11e6-819f-1d414aa937b8.png)

Plz find the image and give some input

MaartenvanSpil commented 7 years ago

This probably has to do with the global image styles Foundation sets. Try giving the preview image: max-width: none; Foundation sets max-width standard to 100%.

.cropit-preview-image { max-width: none; }