inline fancybox modal testing

just testing to see if i can get a fancybox popup loading using an inline script rather than a document ready one, might be easier to implement.
similar to this one, but without the need for document ready checking. also if you enable the modal mode, then it remove the x at the top of the box and stops you from being able to close out of it, which is kind of annoying, but useful if you want to lock some content behind the modal. Added an example of modal:false and modal:true below. You can test a working version of the code below.

clicking modal demo

HTML

<button id='open_popup' class='btn btn-primary' onclick="$.fancybox.open({ src: '#pop-up', modal: false});">Open Popup (Modal False)</button>
<button id='open_popup' class='btn btn-primary' onclick="$.fancybox.open({ src: '#pop-up', modal: true});">Open Popup (Modal True)</button>

<div style="display: none; max-width:700px;" id="pop-up" >
<div>
    <h2>My Content</h2>
    <p>some content</p>
    <center><button data-fancybox-close class="button">Close</button></center>
</div>
</div>

Scripts

<link rel="stylesheet" type="text/css" media="all" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.js"></script>

Other Items in javascript
Page Views

This page has been viewed 197 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹

Random Quote
time you enjoyed wasting is not wasted time
Unknown