For usability purposes I have added a custom javascript, for moving the "close" link to the upper right corner, and adding a label.

Unfortunately I was not able to add it as a patch, but I thought it would be a good idea to share it anyway. Perhaps someone else can figure out how to add a "custom options" field or similar.

Javascript (you can put this in a separate file in you theme folder):

	$(document).ready(function() {
	  function moveCloseLink(){
		// Set variables
		var sbClose = $('#sb-nav-close');
		var sbTitle = $('#sb-title');

		// Add the title from the close link to Drupal's t() function
		sbClose.attr('title',Drupal.t('Close'));

		if(sbTitle) {
		  // Add a span to sbTitle with Shadowbox close link
		  // Don't add the text directly to the <a> tag, there is a IE7/8 issue with "filter: .. AlphaImageLoader .."
		  sbTitle.append('<span id="sb-nav-label">' + sbClose.attr('title') + '</span>').click(function() {Shadowbox.close()});
		  // Append sbTitle
		  sbTitle.append(sbClose);
		}
	  }

	  // Call the function when Shadowbox opens
	  Shadowbox.options.onOpen = moveCloseLink;
	});

CSS:

	#sb-nav-label,
	#sb-nav-close {
	  cursor: pointer;
	  position: absolute;
	  top: 8px;
	  right: 0;
	}

	#sb-nav-label {
	  color: #fff;
	  font-size: 75%;
	  font-weight: bold;
	  line-height: 115%;
	  right: 20px;
	}

	#sb-nav-close {
	  height: 13px;
	  width: 13px;
	}

Hopefully this saves someone else the time I have spent on this issue. :)

CommentFileSizeAuthor
#2 close.png1.49 KBcolorado

Comments

manfer’s picture

Status: Active » Closed (works as designed)
colorado’s picture

StatusFileSize
new1.49 KB

Thank you for this!

I did it this way:

added the css to shadowbox.css, and the js to shadowbox.js, both located in the sites/all/libraries/shadowbox folder.

Following is the css I used with the below attached close.png (I replaced the close.png in the same folder with the one attached here.)

#sb-nav-label,
#sb-nav-close {
  cursor: pointer;
  position: absolute;
}

#sb-nav-label {
  color: #fff;
  background-color: #8b0000;
  font-size: 110%;
  font-weight: bold;
  line-height: 15px;
  top: 0px;
  right: 0px;
  padding: 6px 27px 4px 5px;
}

#sb-nav-close {
  background-color: #8b0000;
  height: 24px;
  width: 24px;
  right: 0px;
  top: 0px;
}