Skip to content

Commit 872c816

Browse files
committed
Fixes #1
1 parent faa7d83 commit 872c816

8 files changed

Lines changed: 26 additions & 18 deletions

File tree

demo/css/simplebox.css

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/js/simplebox.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
$.fn.simplebox = function(options) {
55
var settings = $.extend({
66
fadeSpeed: 400,
7-
imgPath: "img/",
7+
imgPath: "img",
88
closeImg: "cross.svg",
99
closeCrossAnimation: true,
1010
}, options);
1111

1212
// Helper Variables
1313
var $body = $("body");
1414
var $overlay = $('<div id="overlay"></div>');
15-
var $cross = $('<img class="cross" src="' + settings.imgPath + settings.closeImg + '">');
15+
var $cross = $('<img class="cross" src="' + settings.imgPath + "/" +settings.closeImg + '">');
1616
var $image = $("<img class='slb'>");
1717
var fadeSpeed = settings.fadeSpeed;
1818

@@ -25,8 +25,7 @@
2525
} else {
2626
$('.cross').hide(settings.fadeSpeed);
2727
}
28-
// $image.addClass('pop-out');
29-
// $image.removeClass('pop-in');
28+
$image.removeClass('slb-opened');
3029
});
3130

3231
$cross.click(function() {
@@ -36,8 +35,7 @@
3635
} else {
3736
$('.cross').hide(settings.fadeSpeed);
3837
}
39-
// $image.addClass('pop-out');
40-
// $image.removeClass('pop-in');
38+
$image.removeClass('slb-opened');
4139
});
4240

4341
return this.each(function() {
@@ -46,14 +44,14 @@
4644

4745
// When the image is clicked
4846
$this.click(function() {
49-
console.log("Click");
5047
var $this = $(this);
5148
var imageSRC = $this.attr("src");
5249
$image.attr("src", imageSRC);
5350
$image.css("max-height", "80%");
5451
$image.addClass('pop-in');
5552
$image.removeClass('pop-out');
5653
$image.addClass('center');
54+
$image.addClass('slb-opened');
5755

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

dist/css/simplebox.css

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/css/simplebox.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/simplebox.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ gulp.task('compileSass', function() {
2929

3030
gulp.task('outputImages', function() {
3131
return gulp.src("src/img/cross.svg")
32-
.pipe(gulp.dest('./demo/img'))
3332
.pipe(gulp.dest('./dist/img'));
3433
});
3534

src/css/simplebox.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
.slb {
22
box-shadow: 2px 2px 12px 1px rgba(0, 0, 0, 0.2);
3-
cursor: pointer;
3+
cursor: -webkit-zoom-in;
4+
cursor: zoom-in;
5+
}
6+
7+
.slb-opened {
8+
cursor: auto;
49
}
510

611
.pop-in {

src/js/simplebox.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
} else {
2626
$('.cross').hide(settings.fadeSpeed);
2727
}
28-
// $image.addClass('pop-out');
29-
// $image.removeClass('pop-in');
28+
$image.removeClass('slb-opened');
3029
});
3130

3231
$cross.click(function() {
@@ -36,8 +35,7 @@
3635
} else {
3736
$('.cross').hide(settings.fadeSpeed);
3837
}
39-
// $image.addClass('pop-out');
40-
// $image.removeClass('pop-in');
38+
$image.removeClass('slb-opened');
4139
});
4240

4341
return this.each(function() {
@@ -46,14 +44,14 @@
4644

4745
// When the image is clicked
4846
$this.click(function() {
49-
console.log("Click");
5047
var $this = $(this);
5148
var imageSRC = $this.attr("src");
5249
$image.attr("src", imageSRC);
5350
$image.css("max-height", "80%");
5451
$image.addClass('pop-in');
5552
$image.removeClass('pop-out');
5653
$image.addClass('center');
54+
$image.addClass('slb-opened');
5755

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

0 commit comments

Comments
 (0)