Link to home
Start Free TrialLog in
Avatar of rafique12
rafique12

asked on

Twitter bootstrap myModal popup

Hi guys,

I am trying to create an auto pop myModal login form using Twitter bootstrap for my Magento store.

I am having difficulty getting the modal to activate both manually or automatically. Would anyone kindly point me in the right direction please?

<script>
jQuery.noConflict();
jQuery("document").ready(function (){ 

       // load the overlay
        if (document.cookie.indexOf('visited=true') == -1) {
			var fifteenDays = 1000*60*60*24*15;
			var expires = new Date((new Date()).valueOf() + fifteenDays);
			document.cookie = "visited=true;expires=" + expires.toUTCString();
			jQuery.bootstrap({width:"580px", inline:true, href:"#myModal"});
		}
		
		jQuery("Modal").bootstrap({width:"580px", inline:true, href:"#Modal"});

 });
</script>

Open in new window


Form code

<div class="modal hide" id="Modal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">x</button>
    <h3>Login to MyWebsite.com</h3>
  </div>
  <div class="modal-body">
    <form method="post" action='' name="login_form">
      <p><input type="text" class="span3" name="eid" id="email" placeholder="Email"></p>
      <p><input type="password" class="span3" name="passwd" placeholder="Password"></p>
      <p><button type="submit" class="btn btn-primary">Sign in</button>
        <a href="#">Forgot Password?</a>
      </p>
    </form>
  </div>
  <div class="modal-footer">
    New To MyWebsite.com?
    <a href="#" class="btn btn-primary">Register</a>
  </div>
</div>

Open in new window


Magento Static Block

<a href="#" class="Modal">Click here to open the popup</a>
<div style='display:none'>
<div id='myModal' style='padding:10px;'>

{{block type="customer/form_login" name="customer_form_mini_modal_login" before="-" template="customer/form/mini.modal.login.phtml"}}

</div>
</div>

Open in new window


Really appreciate the help guys!
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial