• 0

modal triggered from menu item?


Question

Posted · Report post

Hi all,

 

Just wanted to know if it's possible to trigger a modal (that opens up a google docs form, essentially an external link) directly from a menu item (in the nav).

 

I've seen other threads that show how to trigger modals from links, etc, but I just can't figure out how to make that happen from a menu item... except using a plug in like Easy Modal, which I've tried and I don't like how their modal doesn't center in the viewport on mobiles (or how their modal looks either, designwise).

 

So if I have this markup to trigger the modal:

<a class="texttrigger" href="#myModal" data-toggle="modal"><img goes here></a>

 

And then this for the modal itself:

 

<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal">×</button>
<h3 id="myModalLabel">The modal's title</h3>
</div>
<div class="modal-body">
<iframe src="https://docs.google.com/spreadsheet/embeddedform?formkey=dHFycFNoUk5XMHJtdUxrUlRXSVJLYVE6MQ" width="760" height="1051" frameborder="0" marginheight="0" marginwidth="0">Cargando...</iframe></div>
</div>
 
How can I adapt this to a menu item?
Any help would be immensely appreciated!

Share this post


Link to post
Share on other sites

6 answers to this question

  • 0

Posted · Report post

Go to Dashboard > Appearance > Menus and click "Screen Options" on the top, right. A new panel will open.  Check the box for CSS Classes, then click the Screen Options button again.

 

Now, go to Menus > Custom Links (same page).   Create a menu link with the Link ONLY -- #myModal

 

Add the class title in the new CSS Class field -- texttrigger

 

If you're using an image instead of text for this link, enter the HTML for the image link in the LABEL field - <img src="....

 

Save the menu item.

 

Make sure your CSS is as described in your post.

 

Now that menu item should link, calling the CSS for the modal.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Firstly:

Rob: I LOVE YOU for replying so quickly!!!!!!!!!!!!!

 

Now, I'm a bit confused:

 

When creating the Custom Link menu item, do I enter literally "#myModal" (without the quotes, of course) in the URL field?

The markup I referenced above I had it applied to a button within the body of a page I'd created.

Now that page (and the button within it) wouldn't exist, since the external link that the button triggered will now be triggered by the Custom Link on the menu, right?? So the "#myModal" string wouldn't be referencing anything that exists anywhere on any page! I'm totally confused...

 

By the way, I'm not sure what you mean by "Make sure your CSS is as described in your post" (I'm assuming you meant the HTML, not the CSS?).

 

Please clarify for this clueless beginner...

Thanks a million!!

 

Carina

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Well, first let me say... even I'm surprised it sorta worked. We did get a modal. It just doesn't contain anything. That's my fault, for being quite weary today. I confused all those divs, somehow with CSS.  Apologies. 

 

Somehow we need to call that stuff into the link.  I'm not sure how and our support team really won't be back till Wednesday.  Tomorrow morning, I'll reach out to one of my colleagues to see if there's a solution for calling the modal to open with content. 

 

In Firebug, the modal link is calling a google spreadsheet, but it's doing so as an href link (a normal URL link) instead of as an iframe (which Menus don't normally do).

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

It didn't work.

The modal you're seeing is an ugly one that is the product of a plugin called "Easy Modal".

I much prefer the design of the Pagelines modals, especially because they load correctly in the viewport so they can be seen entirely (as opposed to this one which in mobiles gets cut off).

I'm using these Easy Modals to make do for the time being but I hope you guys can tell me how to use the Pagelines modals...

 

Please let me know when you find out.

Thanks, Rob!

 

Carina

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi Carina,

 

The PageLines modal is actually a Bootstrap modal and its not possible as far as I know to trigger the modal from a menu item. I recommend you contact one of our Pros, as they may be able to help you.

 

http://www.pagelines.com/pros/

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Any update if this is possible yet?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now