views:

70

answers:

3
Zoom.addEventListener('click', function(){$(document).ready(function(){$("#draggable").draggable({containment: '#imgContainer', scroll: false});});});

let me first explain the code. Zoom is a handler/button on clicking which i am enabling the dragging of an image object.

the above code works fine with Chrome but FF is finding errors. Let me quote Firebug:

[Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://localhost/slide/script.js :: anonymous :: line 69" data: no]
[Break on this error] Zoom.addEventListener('click', functio... '#imgContainer', scroll: false});});});

i am getting it to work fine in Chrome but in Firefox i cannot click the button. pls help me out...

+1  A: 

It seems a little strange that you are doing a document ready inside the click event. It would make more sense to do it like this.

$(function(){//Document ready
$('zoom button').click(function(){
 $("#draggable").draggable(
  {containment: '#imgContainer', 
  scroll: false
 });
});

});

I think thats what you need from the code provided. Maybe that will solve the issue.

Nooshu
+2  A: 

Assuming Zoom is a button object you've set somewhere, if I understand what you're trying to do correctly, then what you need is:

$(function() {
  $(Zoom).click(function() {
    $("#draggable").draggable({
      containment: '#imgContainer',
      scroll: false
    });
  });
});

If Zoom is already a jQuery object, then Zoom.click(... will be sufficient.

cletus
+1  A: 
simon
thank you so much. totally my fault. i neglected that.
amit
This still doesn't explain why there is a ready() call in the middle of this.
cletus