Skip to content

Commit

Permalink
Issue #11: Update some jQuery deprecations.
Browse files Browse the repository at this point in the history
Fixes #11.
  • Loading branch information
laryn committed Aug 8, 2024
1 parent 48c2fc9 commit 81bfb54
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/picture.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (typeof Backdrop !== 'undefined' && typeof jQuery !== 'undefined') {
$.colorbox.resize();
// Make sure the colorbox resizes always when the image is changed.
$('img', context).once('colorbox-lazy-load', function(){
$(this).load(function(){
$(this).on('load', function(){
// Ensure there's no max-width / max-height otherwise we won't get
// the proper values. We could use naturalWeight / naturalHeight
// but that's not supported by <IE9 and Opera.
Expand Down
2 changes: 1 addition & 1 deletion js/picture.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions js/picture_colorbox.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function ($) {
Backdrop.behaviors.pictureLazyloadPictures = {
attach: function (context, settings) {
$(context).bind('cbox_load', function () {
$(context).on('cbox_load', function () {
var href = $.colorbox.element()[0].hash;

if (href.search('#picture-colorbox-') === 0) {
Expand All @@ -14,7 +14,7 @@
picture = picture.replace(/<span/ig, '<picture');
picture = picture.replace(/<\/span>/ig, '</picture>');
picture = picture.replace(/ data-srcset="/ig, ' srcset="');
$('img', picture).load(function() {
$('img', picture).on('load', function() {
// Ensure there's no max-width / max-height otherwise we won't get
// the proper values. We could use naturalWeight / naturalHeight
// but that's not supported by <IE9 and Opera.
Expand All @@ -31,7 +31,7 @@

return $(picture).attr('lazyload', null);
});
}).bind('cbox_complete', function () {
}).on('cbox_complete', function () {
$.colorbox.resize();
});
}
Expand Down

0 comments on commit 81bfb54

Please sign in to comment.