Jump to content
Sign in to follow this  
dauruk0512

Crop in the place and prevent multiple time

Recommended Posts

Hi Again, thanks for anyone read or help me figure this issue, i got this tutorial from here , please click and check

 

how can i make when

 

  1. users click crop only the result crop images in the box
  2. prevent user only 1 click

 

i knew why users can click crop multiple time and results multiple images too cause this script

 

line 62 from index.html

 $('#btnCrop').on('click', function(){
          var img = cropper.getDataURL()
      $('.cropped').append('<img src="'+img+'">');
  })

Any one please guide me

Edited by dauruk0512

Share this post


Link to post
Share on other sites

With jQuery you can use the off method to remove an event handler that you added with the on method. You'll need to make the event handler a regular function instead of an anonymous function though. You can also just use a variable to keep track of whether they already ran that function and only run it once.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...