Solved

jQuery Plugin Help

Posted on 2015-01-07
2
163 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

758 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

20 Experts available now in Live!

Get 1:1 Help Now