Bug Tracker

Opened 6 years ago

Closed 6 years ago

#7230 closed bug (invalid)

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

Reported by: george@… 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

Change History (1)

comment:1 Changed 6 years ago by addyosmani

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

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.

Note: See TracTickets for help on using tickets.