Bug Tracker

Modify

Ticket #7230 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

$(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:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by addyosmani

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

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.

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.