Jump to content

Crop in the place and prevent multiple time


dauruk0512
 Share

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
Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...