Skip to main content

Bug Tracker

Side navigation

#7230 closed bug (invalid)

Opened October 18, 2010 03:48AM UTC

Closed October 18, 2010 04:10AM UTC

$(this) isn't working like it used to in jquery 1.4.2

Reported by: george@readingroom.com.au Owned by:
Priority: low Milestone: 1.6
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

I upgraded to jquery 1.4.3 on a site I'm developing at the moment and it caused this piece of code to break:

$("a.lightbox").fancybox({

onStart: function () {

var video_URL = $(this).attr('href');

var video_id = '#' + video_URL.split('#')[1];

$(video_id).show();

},

onClosed: function () {

var video_URL = $(this).attr('href');

var video_id = '#' + video_URL.split('#')[1];

$(video_id).hide();

},

'transitionIn': 'elastic',

'transitionOut': 'elastic',

'speedIn': 600,

'speedOut': 200,

'titleShow': false,

'overlayOpacity': 0.7

});

This is a call to the fancybox plugin (fancybox.net) which works perfectly in jquery 1.4.2

The error that occurs is that the variable video_URL is undefined because $(this).attr('href') no longer seems to refer to the href attribute of a.lightbox even though it does when using jquery 1.4.2

Attachments (0)
Change History (1)

Changed October 18, 2010 04:10AM UTC by addyosmani comment:1

priority: undecidedlow
resolution: → invalid
status: newclosed

This bug tracker is for tracking issues related to the jQuery core.

If you would like assistance in solving issues related to the above plugin, please ask for help in the jQuery forums (we have a section there that deals exclusively with plugin related problems). If it should arise that $(this).attr('href') is indeed broken and you can provide a working test case for us to evaluate, we'll take another look at it.