Commit 68d76434 authored by frjo's avatar frjo
Browse files

Issue #1933956 by frjo | davidd07: Behaviors Attach and cbox_complete.

parent b8537230
...@@ -17,13 +17,11 @@ Drupal.behaviors.initColorbox = { ...@@ -17,13 +17,11 @@ Drupal.behaviors.initColorbox = {
$('.colorbox', context) $('.colorbox', context)
.once('init-colorbox') .once('init-colorbox')
.colorbox(settings.colorbox); .colorbox(settings.colorbox);
$(context).bind('cbox_complete', function () {
Drupal.attachBehaviors('#cboxLoadedContent');
});
} }
}; };
{
$(document).bind('cbox_complete', function () {
Drupal.attachBehaviors('#cboxLoadedContent');
});
}
})(jQuery); })(jQuery);
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Drupal.behaviors.initColorboxDefaultStyle = { Drupal.behaviors.initColorboxDefaultStyle = {
attach: function (context, settings) { attach: function (context, settings) {
$(document).bind('cbox_complete', function () { $(context).bind('cbox_complete', function () {
// Only run if there is a title. // Only run if there is a title.
if ($('#cboxTitle:empty', context).length == false) { if ($('#cboxTitle:empty', context).length == false) {
$('#cboxLoadedContent img', context).bind('mouseover', function () { $('#cboxLoadedContent img', context).bind('mouseover', function () {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Drupal.behaviors.initColorboxPlainStyle = { Drupal.behaviors.initColorboxPlainStyle = {
attach: function (context, settings) { attach: function (context, settings) {
$(document).bind('cbox_complete', function () { $(context).bind('cbox_complete', function () {
// Make all the controls invisible. // Make all the controls invisible.
$('#cboxCurrent, #cboxSlideshow, #cboxPrevious, #cboxNext', context).addClass('element-invisible'); $('#cboxCurrent, #cboxSlideshow, #cboxPrevious, #cboxNext', context).addClass('element-invisible');
// Replace "Close" with "×" and show. // Replace "Close" with "×" and show.
...@@ -24,7 +24,7 @@ Drupal.behaviors.initColorboxPlainStyle = { ...@@ -24,7 +24,7 @@ Drupal.behaviors.initColorboxPlainStyle = {
} }
}); });
}); });
$(document).bind('cbox_closed', function () { $(context).bind('cbox_closed', function () {
$('#cboxClose', context).removeClass('cbox-close-plain'); $('#cboxClose', context).removeClass('cbox-close-plain');
}); });
} }
......
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
Drupal.behaviors.initColorboxStockholmsyndromeStyle = { Drupal.behaviors.initColorboxStockholmsyndromeStyle = {
attach: function (context, settings) { attach: function (context, settings) {
$(document).bind('cbox_open', function () { $(context).bind('cbox_open', function () {
// Hide close button initially. // Hide close button initially.
$('#cboxClose', context).css('opacity', 0); $('#cboxClose', context).css('opacity', 0);
}); });
$(document).bind('cbox_load', function () { $(context).bind('cbox_load', function () {
// Hide close button. (It doesn't handle the load animation well.) // Hide close button. (It doesn't handle the load animation well.)
$('#cboxClose', context).css('opacity', 0); $('#cboxClose', context).css('opacity', 0);
}); });
$(document).bind('cbox_complete', function () { $(context).bind('cbox_complete', function () {
// Show close button with a delay. // Show close button with a delay.
$('#cboxClose', context).fadeTo('fast', 0, function () {$(this).css('opacity', 1)}); $('#cboxClose', context).fadeTo('fast', 0, function () {$(this).css('opacity', 1)});
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment