• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

jQuery Plugin Help

Hi I'm using this jQuery plugin: imgAreaSelect

I have the plugin working on this page.

But my problem comes when I try to use it on my site.  I put all the JS on the page, but the image i want to use the plugin on gets ajaxed in to the page.  I think this might be the problem.  I tried doing this:

$.ajaxSetup({
  complete: function () {
	$('#ias').imgAreaSelect({ aspectRatio: '1:1', handles: true,         
		onSelectEnd: function (img, selection) {
			$('input[name="x1"]').val(selection.x1);
			$('input[name="y1"]').val(selection.y1);
			$('input[name="x2"]').val(selection.x2);
			$('input[name="y2"]').val(selection.y2);            
		} 
	});			
  }
});

Open in new window


But it doesn't work either.  I even tried putting it in a $(document).ready function but that didn't work either.

If you want to see the page you can view it here.  Just hover over the profile pic box and you'll see a link to change your profile picture.  Click the link.  Then upload a picture with the form.  Then you'll see your picture gets displayed on the page, but the imgAreaSelect plugin isn't working on the image.  I need it to be able to make a selection like it does on the page where the plugin is working.

Thanks for any help!
0
Elxn
Asked:
Elxn
1 Solution
 
Tom BeckCommented:
Some observations that may help.

On the page that works, you are loading jquery.min.js two times, once from Google and once locally.

On the page that does not work you are only loading once from Google.

On the page that does not work I see an error pointing to that jquery.min.js file from Google.
Syntax error on jQuery.min.jsSeems like more than a coincidence.
0
 
ElxnAuthor Commented:
Well, well well.  Mr. Beck pulls out another win!  GO BECK!

Thanks man.  I added the word "function" before the function name and that seemed to fix the problem.  Although one error in JS must mean the rest of it won't work either; i don't really get it.

But you did it!  Yea!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now