Solved

jQuery Plugin Help

Posted on 2015-01-07
2
164 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
2 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Download a website to hdd 2 50
Message not shown 5 33
Redirect Website for Mobile Devises 7 32
how can i count words? 2 16
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn how to dynamically set the form action using jQuery.

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now