Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,9 @@

var positions = (this.position + '').toLowerCase().match(/\S+/g) || [];

if (positions.length < 1) {
positions.push('center');
}
if (positions.length == 1) {
positions.push(positions[0]);
}
if (positions.length < 1) positions.push('center');

if (positions.length == 1) positions.push(positions[0]);

if (positions[0] == 'top' || positions[0] == 'bottom' || positions[1] == 'left' || positions[1] == 'right') {
positions = [positions[1], positions[0]];
Expand All @@ -71,19 +68,15 @@
self.positionY = positions[1];

if (this.positionX != 'left' && this.positionX != 'right') {
if (isNaN(parseInt(this.positionX))) {
this.positionX = 'center';
} else {
this.positionX = parseInt(this.positionX);
}
isNaN(parseInt(this.positionX)) ?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of this can be in one line.

this.positionX = 'center' :
this.positionX = parseInt(this.positionX);
}

if (this.positionY != 'top' && this.positionY != 'bottom') {
if (isNaN(parseInt(this.positionY))) {
this.positionY = 'center';
} else {
this.positionY = parseInt(this.positionY);
}
isNaN(parseInt(this.positionY)) ?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

this.positionY = 'center' :
this.positionY = parseInt(this.positionY);
}

this.position =
Expand Down Expand Up @@ -120,7 +113,7 @@
if (slider.length == 0)
this.$slider = $('<img />').prependTo(this.$mirror);
else {
this.$slider = slider.prependTo(this.$mirror)
this.$slider = slider.prependTo(this.$mirror);
sliderExisted = true;
}

Expand Down Expand Up @@ -379,12 +372,9 @@
{
$.extend($this.data('px.parallax'), options);
}

if (typeof option == 'string') {
if(option == 'destroy'){
Parallax.destroy(this);
}else{
Parallax[option]();
}
option == 'destroy' ? Parallax.destroy(this) : Parallax[option]();
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion parallax.min.js

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