wpsharks / alert-box-shortcode

Alert Box Shortcode for WordPress by WP Sharks™.
https://wpsharks.com/
GNU General Public License v3.0
0 stars 0 forks source link

Enhancement: Modal Alert Box #3

Open Reedyseth opened 8 years ago

Reedyseth commented 8 years ago

It would be nice to give the alert box the hability to work as a modal window. This will improve the visibility of the alert box. Of course there are more styles to add to the Alert Box to look nicer.

image

raamdev commented 8 years ago

Hmm, how would this work from an implementation perspective? What would trigger the modal alert? It seems repetitive to me to have an alert on the page + another alert as a modal window.

A modal window alert seems like something that would need to be implemented as part of whatever application is generating the alert, as opposed to something that's a shortcode that can be embedded inside a WordPress Post/Page (as the Alert Box Shortcode plugin can).

Reedyseth commented 8 years ago

Hmm, how would this work from an implementation perspective?

Using an attribute to define the windows as modal modal="true"

What would trigger the modal alert?

I could be load with the page and start as modal. or have a link to trigger it in order to display more information.

It seems repetitive to me to have an alert on the page + another alert as a modal window.

Yes, that alert box in the back was a differente alert box with the same message, it should be only one.

A modal window alert seems like something that would need to be implemented as part of whatever application is generating the alert, as opposed to something that's a shortcode that can be embedded inside a WordPress Post/Page (as the Alert Box Shortcode plugin can)

I am totally agree, it would be the result of an action in the application, so we can drop the idea haha.

jaswrks commented 8 years ago

A modal window alert seems like something that would need to be implemented as part of whatever application is generating the alert, as opposed to something that's a shortcode that can be embedded inside a WordPress Post/Page (as the Alert Box Shortcode plugin can).

There could be an attribute in the shortcode like this:

[alert_box modal="true" on_click="a.some-class"]You clicked this link.[/alert_box]

So the alert box would be hidden by default and instead attached via jQuery to an onClick handler.

<?php
echo '<script type="text/javascript">';
echo "$('".$attr['on_click']."').on('click', function() { $('#".$id."').show(); }";
echo '</script>';