Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

jQuery Plugin Help

Posted on 2015-01-07
2
Medium Priority
?
175 Views
Last Modified: 2015-01-07
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
Comment
Question by:Elxn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 2000 total points
ID: 40536391
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
 
LVL 2

Author Closing Comment

by:Elxn
ID: 40536433
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question