Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * jquery.vslb.js
- * とてもシンプルなLightBoxプラグイン
- * Version : 0.1.1 rev1
- * Copyright : ww24
- * License : MIT License
- */
- (function ($) {
- var count = 0;
- $.fn.vslb = function (options) {
- options = options ? options : {};
- var $target = $(this);
- if ($target.parent().attr("class") !== "slightbox-lb") {
- var zIndex = options.zIndex ? options.zIndex : 0 + count++,
- $win = $(window),
- $lb = $target.wrap('<div class="slightbox-lb" />').parent();
- $("body").append('<div class="slightbox-bg" title="close" />')
- .find(".slightbox-bg:last-child").click(function () {
- count--;
- $(this).remove();
- $target.unwrap();
- if (options.close) {
- options.close();
- }
- }).css({
- zIndex: zIndex++,
- opacity: 0
- }).animate({opacity: 0.8});
- $lb.css({
- width: $lb.width(),
- height: $lb.height(),
- left: $win.width() / 2 - $lb.outerWidth() / 2 + $win.scrollLeft(),
- top: $win.height() / 2 - $lb.outerHeight() / 2 + $win.scrollTop(),
- zIndex: zIndex,
- display: "none"
- }).fadeIn("normal", function () {
- if (options.open) {
- options.open();
- }
- });
- }
- return this;
- };
- })(jQuery);
Add Comment
Please, Sign In to add comment