Skip to content

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
libhide committed Nov 8, 2015
1 parent faa7d83 commit 872c816
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
6 changes: 5 additions & 1 deletion demo/css/simplebox.css

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

12 changes: 5 additions & 7 deletions demo/js/simplebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
$.fn.simplebox = function(options) {
var settings = $.extend({
fadeSpeed: 400,
imgPath: "img/",
imgPath: "img",
closeImg: "cross.svg",
closeCrossAnimation: true,
}, options);

// Helper Variables
var $body = $("body");
var $overlay = $('<div id="overlay"></div>');
var $cross = $('<img class="cross" src="' + settings.imgPath + settings.closeImg + '">');
var $cross = $('<img class="cross" src="' + settings.imgPath + "/" +settings.closeImg + '">');
var $image = $("<img class='slb'>");
var fadeSpeed = settings.fadeSpeed;

Expand All @@ -25,8 +25,7 @@
} else {
$('.cross').hide(settings.fadeSpeed);
}
// $image.addClass('pop-out');
// $image.removeClass('pop-in');
$image.removeClass('slb-opened');
});

$cross.click(function() {
Expand All @@ -36,8 +35,7 @@
} else {
$('.cross').hide(settings.fadeSpeed);
}
// $image.addClass('pop-out');
// $image.removeClass('pop-in');
$image.removeClass('slb-opened');
});

return this.each(function() {
Expand All @@ -46,14 +44,14 @@

// When the image is clicked
$this.click(function() {
console.log("Click");
var $this = $(this);
var imageSRC = $this.attr("src");
$image.attr("src", imageSRC);
$image.css("max-height", "80%");
$image.addClass('pop-in');
$image.removeClass('pop-out');
$image.addClass('center');
$image.addClass('slb-opened');

$overlay.css('pointer-events', 'initial');

Expand Down
6 changes: 5 additions & 1 deletion dist/css/simplebox.css

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

2 changes: 1 addition & 1 deletion dist/css/simplebox.min.css

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

2 changes: 1 addition & 1 deletion dist/js/simplebox.min.js

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

1 change: 0 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ gulp.task('compileSass', function() {

gulp.task('outputImages', function() {
return gulp.src("src/img/cross.svg")
.pipe(gulp.dest('./demo/img'))
.pipe(gulp.dest('./dist/img'));
});

Expand Down
7 changes: 6 additions & 1 deletion src/css/simplebox.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.slb {
box-shadow: 2px 2px 12px 1px rgba(0, 0, 0, 0.2);
cursor: pointer;
cursor: -webkit-zoom-in;
cursor: zoom-in;
}

.slb-opened {
cursor: auto;
}

.pop-in {
Expand Down
8 changes: 3 additions & 5 deletions src/js/simplebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
} else {
$('.cross').hide(settings.fadeSpeed);
}
// $image.addClass('pop-out');
// $image.removeClass('pop-in');
$image.removeClass('slb-opened');
});

$cross.click(function() {
Expand All @@ -36,8 +35,7 @@
} else {
$('.cross').hide(settings.fadeSpeed);
}
// $image.addClass('pop-out');
// $image.removeClass('pop-in');
$image.removeClass('slb-opened');
});

return this.each(function() {
Expand All @@ -46,14 +44,14 @@

// When the image is clicked
$this.click(function() {
console.log("Click");
var $this = $(this);
var imageSRC = $this.attr("src");
$image.attr("src", imageSRC);
$image.css("max-height", "80%");
$image.addClass('pop-in');
$image.removeClass('pop-out');
$image.addClass('center');
$image.addClass('slb-opened');

$overlay.css('pointer-events', 'initial');

Expand Down

0 comments on commit 872c816

Please sign in to comment.