javascript - Launch Popup once Page Opens (using Magnific Popup) -


i trying have popup (about page of website) once web first launch. using magnific popup - modal popup , have hard time figuring how that. popup works fine, when such website launches, user clicks "about" button.

i appreciate given. thanks, guys:)

script:

$(function () {     $('.popup-modal').magnificpopup({       type: 'inline',       preloader: false,       focus: '#username',       modal: true     });     $(document).on('click', '.popup-modal-dismiss', function (e) {       e.preventdefault();       $.magnificpopup.close();     }); }); 

html:

<div class="html-code">       <a class="popup-modal" href="#test-modal">about</a>        <div id="test-modal" class="mfp-hide white-popup-block">         <p>change way think recipes. text link interchanges verbs , nouns of recipes.</p>         <p><a class="popup-modal-dismiss" href="#">close</a></p>       </div> 

css:

.popup-modal{     text-decoration: none;     font-weight: bold;     color:black;     position:fixed;     left:0;     margin-left: 50px;     bottom:0;     margin-bottom: 25px; }  #test-modal{     background-color: white;     padding: 30px 40px;     text-align:left;     max-width: 650px;     margin:40px auto;     position:relative;      font-size: 15pt;     line-height: 25pt; }  .popup-modal-dismiss{     text-align: right;     font-size: 10pt;     text-decoration: none; } 

you may open popup directly @ initialization using .magnificpopup('open');

$(function () {     $('.popup-modal').magnificpopup({       type: 'inline',       preloader: false,       focus: '#username',       modal: true     }).magnificpopup('open');      $(document).on('click', '.popup-modal-dismiss', function (e) {       e.preventdefault();       $.magnificpopup.close();     }); }); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -