Solved

jQuery Plugin Help

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

733 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