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

option - modal does not seem to work #926

Open
uudruid74 opened this issue Aug 3, 2015 · 8 comments
Open

option - modal does not seem to work #926

uudruid74 opened this issue Aug 3, 2015 · 8 comments

Comments

@uudruid74
Copy link

I have tried setting modal: true, and modal: false, and it does not seem to make any difference. In firefox, the gallery is always shown in the enclosing DIV. In Chrome, it always shows the size of the entire viewport, and with other elements of my site over it. It refuses to be contained! This makes it almost impossible to use since the full-screen button is hidden under elements.

Is there some sort of option, similar to "modal" that would allow me to force it to open full-screen? I know others have asked for an option to have the gallery to come up opened. I still want to open from an icon, but would want to open it full-screen once the user opens it. This would probably solve the issue with Chrome. Ideally, the defaults would be to open full-screen on Chrome and on all mobile browsers, but if I have to detect this myself and set the option, that would be fine. Any chance at an auto-full-screen option?

@uudruid74
Copy link
Author

I thought I would add more information. I'm not sure where the issue is at, but it has to do with Chrome and Firefox not quite inheriting things the same way. I added the following in my openPhotoSwipe function, but doing this will also stop rotation from working correctly and stop full-screen. I would have to reset both of these. Should I start hacking the javascript source, or is the layout of the site incorrect (in spite of the fact that it works great in Firefox, exactly how it should).

if (/chrome/i.test( navigator.userAgent )) {
var copyElement = document.getElementById('main-top');
pswpElement.style.height = copyElement.offsetHeight+"px";
pswpElement.style.width = copyElement.offsetWidth+"px";
pswpElement.style.margin = copyElement.offsetTop + "px " + copyElement.offsetLeft + "px";
}

@dimsemenov
Copy link
Owner

There is an example in FAQ on how to use modal option http://photoswipe.com/documentation/faq.html#inline-gallery

@uudruid74
Copy link
Author

Yes, read it, and firefox and chrome are displaying things completely different. I added the above hack to force chrome to display like Firefox does, but this stops full-screen from working. I've got full-screen disabled if the chrome browser is detected until I can find something better

@dimsemenov
Copy link
Owner

@uudruid74
Copy link
Author

uudruid74 commented Aug 5, 2015 via email

@uudruid74
Copy link
Author

OK. I have found a fix to make Chrome work. If I go to.the container in which I want the gallery displayed and add position: relative; then this fixes the problem with Chrome, but modal still does not change the display. I am getting two errors in js both saying an empty string has been passed to getElementById. Should the container have a specific ID?

@uudruid74
Copy link
Author

Wait. Chrome obeys modal in my site, firefox keeps it penned in. I was able to recreate some of this mess by removing the fixed sizes on the codfish page. Firefox and Chrome seem to behave differently when you don't specify a size.

@uudruid74
Copy link
Author

Last comment. It seems height is the adding factor and a percent isn't enough. It has to be fixed.

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

No branches or pull requests

2 participants