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

Changed hiding of slides by using visibility instead of display. #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sdcloudt
Copy link

In the h5p community there is interest in using MathJax in h5p elements: https://h5p.org/comment/2934#comment-2934
If one would create a new Question type which uses MathJax (which I have done but unfortenately I cannot share it) the use of jQuery's hide and show causes MathJax to render wrong on hidden questions. This is because hide and show set and unset the css display property to none. It is a well known problem that MathJax fails to render when using display:none: https://github.com/mathjax/MathJax-docs/wiki/Dealing-with-display:none.
The solution I propose in this PR is to add and remove the class h5p-questionset-visible, instead of hide and show, and to then define visibility by visibility:hidden; position: absolute; left: -100%;.

This PR enables me to use MathJax in my questions without any problems.

As future use cases might include the use of MathJax, one wants to avoid
the use of `display: none` to hide elements. By using `visibility:
hidden` in combination with a offscreen position almost the same effect
is achieved.
@otacke
Copy link
Contributor

otacke commented Aug 16, 2018

Hi @sdcloudt !

Thanks for your contribution! We're giving our own solution for LaTeX support the finishing touches right now, and it doesn't require the changes that you're proposing. It will feature several options to (re)render divs as needed (with MathJax or KaTeX). Also, it will not require to change any content types.

What do you think? Would that solve your issue as well?

Cheers,
Oliver

@sdcloudt
Copy link
Author

sdcloudt commented Aug 16, 2018 via email

@otacke
Copy link
Contributor

otacke commented Aug 17, 2018

Hi Stefan!

I don't think there's something wrong with your code, and I have seen moving elements out of the visual area instead of not displaying them before, but mostly for transitioning effects. Maybe @fnoks could share his thoughts on this issue as well?

@sdcloudt
Copy link
Author

Bump @fnoks ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants