Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Crossfade #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions MMM-Wallpaper.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
}

.MMM-Wallpaper .crossfade-image {
position: absolute;

Choose a reason for hiding this comment

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

I tested this code and while it does fix the issues with the crossfade, this doesn't seem to work when the fillRegion param is set to false. I want the slideshow to play in a specific region of the magic mirror display; not the whole background, and setting the position to absolute overrides the width/height values I've set up in the config and it fills the whole region with a cropped image.

transition: opacity 1s ease-in-out;
}

Expand Down
7 changes: 7 additions & 0 deletions MMM-Wallpaper.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ Module.register("MMM-Wallpaper", {
element.style.opacity = 1;
self.title.style.display = "none";

if(self.config.crossfade){
images = document.getElementsByClassName("crossfade-image")
if(images.length > 1 ){
images[0].style.opacity = 0
}
}
Comment on lines +146 to +151
Copy link
Owner

Choose a reason for hiding this comment

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

Should call this on self.wrapper, as there may be multiple MMM-Wallpaper modules on the page, and one shouldn't affect the others. Also, should keep the formatting consistent with the rest of the file:

Suggested change
if(self.config.crossfade){
images = document.getElementsByClassName("crossfade-image")
if(images.length > 1 ){
images[0].style.opacity = 0
}
}
if (self.config.crossfade) {
images = self.wrapper.getElementsByClassName("crossfade-image");
if (images.length > 1) {
images[0].style.opacity = 0;
}
}


setTimeout(() => {
var caption = imageData.caption;
if (self.config.caption && caption) {
Expand Down