I just migrate Foundation 4 to Foundation 5.
I had a problem with detecting a modality in foundation 5 (it worked in foundation 4!) When I open a modal expression with a jquery script: the display modality appears, but cannot be closed (neither by clicking on X, or by clicking on the background) Here is my code:
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation</title>
<link rel="stylesheet" href="stylesheets/app.css" />
<script src="bower_components/modernizr/modernizr.js"></script>
</head>
<body>
<p><a href="#" class="add2cart button">Reveal Modal</a></p>
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/foundation/js/foundation.min.js"></script>
<script>$(document).foundation()</script>
<script type="text/javascript">
$(document).on("click",".add2cart",function(){
$('body').append('<div id="added2cart" class="reveal-modal small" data-reveal><p>My reveal-modal appears but can\'t be closed !</p><a class="close-reveal-modal">×</a></div>');
$('#added2cart').foundation('reveal', 'open');
});
</script>
</body>
</html>`
Any idea why?
Thanks in advance!
source
share