Posts tagged ‘plugin’

SimpleModal Contact Form (SMCF) 1.1 Released

Thursday, March 13th, 2008

SMCF 1.1 includes the following changes:

  • Fixed image pre-loading to actually pre-load ;)
  • Added new effects on form open and close
  • Added a security feature
  • Added optional subject and cc sender form elements
  • Added common classes to form elements
  • Renamed all classes and ID’s to prevent collisions
  • Added WordPress translation ability on text elements (__() and _e() functions)
  • Upgraded to SimpleModal v1.1.1 and jQuery 1.2.3
  • Moved SimpleModal and SMCF JavaScript file loading to the footer

For more information and the download, please visit the SMCF WordPress Plugin Page.

SimpleModal Contact Form (SMCF) 1.0 Released

Sunday, January 6th, 2008

SimpleModal Contact Form (SMCF) is an Ajax powered modal dialog contact form for WordPress.

The project and all of the information about it is hosted on WordPress.org.

If you have any feedback regarding the plugin, please let me know.

SimpleModal v1.1 Released

Friday, January 4th, 2008

There are three new options and the handling of data has been revamped. For more details, including documentation, demos, tests and downloads, visit the project page.

I’m finishing up a WordPress plugin based on SimpleModal, which should be ready soon. The Contact link above is powered by the new WordPress plugin.

SimpleModal v1.0 released

Friday, October 19th, 2007

While developing a recent project at work, I had the need to display a modal dialog. I started using jQuery recently and so I started by looking for a jQuery modal dialog plugin.

I did find a couple of existing ones (jqModal and BlockUI), but neither did exactly what I was looking for. So…I decided to take a crack at writing my first jQuery plugin.

It has been a great learning experience and has caused me to become an even bigger fan of jQuery. I’ve used a few other JavaScript libraries (MooTools, Prototype, etc), but jQuery is something special.

So, if you have a need for a modal dialog…be sure to check out SimpleModal.

View Demo

SimpleModal

Thursday, October 18th, 2007
v1.0.1

Summary

SimpleModal is a lightweight jQuery plugin that provides a simple interface to create a modal dialog.

The goal of SimpleModal is to provide developers with a cross-browser overlay and container that will be populated with content provided to SimpleModal.

Demo

Download

Support

Usage

As a jQuery chained function, where content is a jQuery object:

content.modal([settings]);

As a stand-alone jQuery function, where content is a jQuery object, a DOM element, or a plain string (which can contain HTML):

$.modal(content, [settings]);

Styling

  • Other than dealing with some IE issues, SimpleModal does not apply styling to any of the elements. modalCloseImg is the only internally defined CSS class, used to style the built-in close icon.
Sample CSS, using default values
#modalOverlay {
  height:100%;
  width:100%;
  position:fixed;
  left:0;
  top:0;
  z-index:3000;
  background-color:#000;
  cursor:wait;
}

#modalContainer {
  height:400px;
  width:600px;
  position:fixed;
  left:50%;
  top:15%;
  margin-left:-300px;
  z-index:3100;
  background-color:#fff;
  border:3px solid #ccc;
}

#modalContainer a.modalCloseImg {
  background:url(../img/x.png) no-repeat;
  width:25px;
  height:29px;
  display:inline;
  z-index:3200;
  position:absolute;
  top:-14px;
  left:588px;
  cursor:pointer;
}
  • For IE 6, the following will handle the PNG used for a.modalCloseImg and fixed positioning for the container and IFRAME:
<!--[if lt IE 7]>
<style type='text/css'>
  body {
    width:100%;
    height:100%;
    padding:0;
    margin:0;
  }
  #modalContainer a.modalCloseImg{
    background:none;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
        enabled=true, src='img/x.png',sizingMethod='scale'
      );
  }
  #modalContainer {
    position: absolute;
    top: expression((document.documentElement.scrollTop
        || document.body.scrollTop) + Math.round(15 *
        (document.documentElement.offsetHeight
        || document.body.clientHeight) / 100) + 'px');
  }
  #modalIframe {
    z-index:1000;
    position:absolute;
    width:100%;
    height:100%;
    top:0;
    left:0;
  }
</style>
<![endif]-->

Settings

Both of the functions above accept an optional settings object, which can contain any/all of the following (default value):

  • overlay: (50) The opacity value, from 0 - 100. 0 = transparent 100 = opaque
  • overlayId: (‘modalOverlay’) The DOM element id for the overlay div
  • containerId: (‘modalContainer’) The DOM element id for the container div
  • iframeId: (‘modalIframe’) The DOM element id for the iframe (IE 6)
  • close: (true) Show the default window close icon? Uses CSS class modalCloseImg
  • closeTitle: (‘Close’) The title value of the default close link. Used if close == true
  • closeClass: (‘modalClose’) The CSS class used to bind to the close event
  • cloneContent: (true) If true, SimpleModal will clone the content element
  • onOpen: (null) The callback function called in place of SimpleModal’s open function
  • onShow: (null) The callback function called after the modal dialog has opened
  • onClose: (null) The callback function called in place of SimpleModal’s close function

Callbacks

The callback functions are called using the JavaScript apply function. One parameter, the dialog object, is sent, which contains the overlay, container, content and iframe objects. In addition, inside the callback, this will refer to the SimpleModal object. This will allow you to call the close function, among other things.

  • onOpen: Useful for adding effects to the opening of the modal dialog elements. Your callback function will be passed an object that contains the overlay, container, content, and iframe (for IE6) elements. SimpleModal will handle “showing” the iframe, if necessary.
Example
content.modal({onOpen: function (dialog) {
  dialog.overlay.fadeIn('slow', function () {
    dialog.container.slideDown('slow', function () {
      dialog.content.fadeIn('slow'); // See Other Notes below regarding
                                     // content display property and
                                     // iframe details
    });
  });
  • onShow: Useful for binding events or any other actions you might want to perform after the modal dialog elements have been displayed. Your callback function will be passed an object that contains the overlay, container, content, and iframe (for IE6) elements.
  • onClose: Useful for adding effects to the closing of the modal dialog elements. Your callback function will be passed an object that contains the overlay, container, content, and iframe (for IE6) elements. $.modal.remove(dialog); can be called to remove all of the elements, or you will need to remove them manually. Example: dialog.content.remove();, etc.
Example
content.modal({onClose: function (dialog) {
  dialog.content.fadeOut('slow', function () {
    dialog.container.slideUp('slow', function () {
      dialog.overlay.fadeOut('slow', function () {
        $.modal.remove(dialog); // must call this to remove
                                // the elements from the DOM
                                // or remove the elements manually
      });
    });
  });
}});

Other Notes

iframe
  • For IE6, SimpleModal handles the creation and removal of an iframe, which is needed to prevent select options from bleeding through the modal dialog. If you use an onClose callback, see onClose in the Callback section above.
Content CSS display Property
  • If you use an onOpen callback, the dialog.content display value will be the same as what was passed in to SimpleModal. So, if you want to use an effect on the dialog.content and the element is not set to display:none, you’ll have to call dialog.content.hide(); first, before you call your open effects.
Cloning and Element Removal
  • By default, SimpleModal will clone the content element that you pass in. In the close function, when cloneContent is true, SimpleModal will “remove” the element, otherwise it will just “hide” it. If you use an onClose callback, you’ll have to deal with removing vs hiding the content element.
  • SimpleModal always removes the overlay, container and iframe elements when closed. If you use an onClose callback, see onClose in the Callback section above.
Browser Compatibility

SimpleModal has been tested in the following browsers:

  • IE 6, 7
  • Firefox 2
  • Opera 9
  • Safari 3

Configuring WordPress

Tuesday, October 9th, 2007

I’ve been playing with configuring WordPress (WP) for this site. After doing some research, I had a plan for how I wanted it to work. Basically, I wanted to use WP to manage my site (like a CMS) as well as for a blog.

After a lot of trial and error, I think I’ve achieved the effect I was looking for. I installed WordPress in the /blog directory. Copied the index.php and .htaccess file into / and edited index.php:

require('blog/wp-blog-header.php');

In wp-admin, under Options > General, I changed “WordPress address (URL)” to http://www.ericmmartin.com/blog and “Blog address (URL)” to http://www.ericmmartin.com. I then created 2 pages, one called Home and one called Blog. Lastly, under Options > Reading, I set the Front Page option to “A static page (select below)” and Home for the Front page and Blog for the Posts page.

Currently, I’ve installed the WP-Syntax, Akismet, Add Your Own Headers and Exec-PHP plugins.

The rest is still a work in progress, but so far, I’m happy with WordPress!