joaopereirawd / animatedModal.js

animatedModal.js is a jQuery plugin to create a fullscreen modal with CSS3 transitions. You can use the transitions from animate.css or create your own transitions.
MIT License
962 stars 207 forks source link

Problem with Initial Click #40

Open djmtype opened 7 years ago

djmtype commented 7 years ago

Seems to be an issue upon the first time the browser loads. When prompting the modal for the first time, it also jumps to the top of the window. No # fragment appended to the url. No JS error. Tried applying e.preventDefault, but still no good. Tested in Chrome, Safari, Firefox

daslicht commented 7 years ago

? http://goo.gl/hIaBKg

uxpromo commented 7 years ago

I have same problem too... After first close->open action scroll don't comes...

rctneil commented 7 years ago

I too am getting this problem. Is there a solution or a possible reason as to why the plugin is exhibiting this strange behaviour?

Thanks, Neil

oliviachang29 commented 6 years ago

This worked for me:

html {
  margin: 0; // remove this line from your css
}
kashirin-dm commented 5 years ago

Seems to be an issue upon the first time the browser loads. When prompting the modal for the first time, it also jumps to the top of the window. No # fragment appended to the url. No JS error. Tried applying e.preventDefault, but still no good. Tested in Chrome, Safari, Firefox

This is not a JS error, it is a nuance of the CSS. When you open a modal window "overflow: hidden" style is added in html and body tags . Then when you close this window, it changes to "overflow: auto".

The default value should be "overflow: visible" It's default value in your browser.

You can remove the following code in animatedModal.js:

$('body, html').css({'overflow':'auto'});
$('body, html').css({'overflow':'hidden'});