Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Added opacity/background support for images
Browse files Browse the repository at this point in the history
  • Loading branch information
angelica authored and angelica committed Feb 15, 2016
1 parent 9ed1680 commit 95add44
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ Note that when specifying these options as html data-attributes, you should conv
<td>false</td>
<td>(Experimental) If true, will freeze the parallax effect when "over scrolling" in browsers like Safari to prevent unexpected gaps caused by negative scroll positions.</td>
</tr>
<tr>
<td>opacity</td>
<td>number</td>
<td>1</td>
<td>You can customize the image transparency.</td>
</tr>
<tr>
<td>background</td>
<td>string</td>
<td>null</td>
<td>You can customize the background behind the image (works with opacity < 1).</td>
</tr>
</tbody>
</table>

Expand Down
5 changes: 5 additions & 0 deletions parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
overflow: 'hidden'
});

if (typeof self.opacity !== undefined)
this.$slider.css({ opacity: self.opacity });
if (typeof self.background !== undefined)
this.$mirror.css({ backgroundColor: self.background });

this.$slider.addClass('parallax-slider').one('load', function() {
if (!self.naturalHeight || !self.naturalWidth) {
self.naturalHeight = this.naturalHeight || this.height || 1;
Expand Down

0 comments on commit 95add44

Please sign in to comment.