Bug Tracker

Modify

Ticket #10412 (closed bug: invalid)

Opened 20 months ago

Last modified 20 months ago

Chrome/Safari issues with click()

Reported by: anonymous Owned by:
Priority: low Milestone: None
Component: event Version: 1.6.4
Keywords: Cc:
Blocking: Blocked by:

Description

Chrome and Safari seem to have a problem with the click() function in that it ignores it if a click() is within another click(). See code:

jQuery.noConflict();
jQuery(document).ready(function($){
	$('a#lb_slideshow').click(function(e){
		e.preventDefault();
		document.getElementById('slideshow_1').click();
	});
});

I'm attempting to load an slideshow (Lightbox 2) with a text link instead of the images themselves.

To fix this I've had to use the javascript fix found here:  http://stackoverflow.com/questions/6157929/how-to-simulate-mouse-click-using-javascript/6158050#6158050 to get this to work.

I'm using Chrome 14.0.835.186 and Safari 5.1(7534.48.3)

Change History

comment:1 Changed 20 months ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to event

click() is a jQuery method (not a DOM method) that can be used to programmatically click an element. See the code below:

jQuery(document).ready(function($) {
	$('a#lb_slideshow').click(function(e){
		e.preventDefault();
		$('#slideshow_1').click();
	});
});

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.