Rogtopia

The Mystical World of Roger.

Hello, My Name is Roger and I enjoy HTML, CSS, and Photoshop. Maybe I can show you some things.

Creating a Custom Themed jQuery UI.

Posted by Roger July 19, 2009 11:15PM

jQuery is a great way to add flare to your site easily with a vast array of utilities to animate, perform ajax calls, modify the DOM, retrieve JSON calls, and various other tasks usually tedious with native javascript. Today, we are going to look at jQuery’s UI library and how you can customize it’s widgets to suit the look and feel of your website.

http://ui.jquery.com/jQuery UI - http://ui.jquery.com/

jQuery UI will provide you with themed user interface widgets such as modals and dialogs, tab systems, date pickers, accordian menus and more.  The beauty of it all, is that you can customize the look of these widgets with an easy to use themer from their website called ThemeRoller.

Simply go through the theme setup and click the download link to use what widgets you would like to include with your jQuery UI javascript frameworking.

A Quicky, Effecient Sample

Visit jQuery UI in a Dialog

<script type="text/javascript">
// the caller
$('.pop-link').poplink();

// the jquery mini-plugin
// finds all anchor elements matching selector and applies a custom click event
// -- takes the href and loads it in a dialog's iframe with showSite().
$.fn.poplink = function() {
  return this.each(function () {
    var _url = $(this).attr('href');
    $(this).bind('click', function(event) {
      event.preventDefault();
      showSite(_url);
    });
  });
}

// the showSite function
var showSite = function (_url) {
  // configure this dialogs defaults
  $('#dialog').dialog({
   'bgiframe':true,
   'modal':true,
   'resizable':false,
   'draggable':false,
   'autoOpen':false,
   'width':980,
   'height':620,
   'title':'Forwarded to ' + _url,
   'buttons' : {
     'close' : function () { $(this).dialog('destroy'); },
     'forward' : function () { history.go(1); },
     'back' : function () { history.go(-1); }
    }
  });

  // empty the dialog and set it's html to the current _url in the iframe
  $('#dialog').empty().html('<iframe src="' + _url + '" marginwidth="0" marginheight="0" style="width:100%;height:100%;" scrolling="auto" frameborders="no"></frame>').dialog('open');
}
</script>

Anyways, Go configure your custom theme and try jQuery UI for yourself.  Fun times to be had by everyone!

Comments

nice

Anyone help with vacation advice?
Spending all of April on a Long Island Romantic Getaways .Some objections in the gang- might look into some of the Places to visit in Philadelphia, Pennsylvania. With all the excitement over South Beach now may be a good time to see the Places to Visit in Florida Need some pointers.

Have a good freeze.

Fellow Tourists
Seriously considering spending some hard earned cash for a Long Island Romantic Getaways .Not 1000% sure - might look into some of the Places to visit in Philadelphia, Pennsylvania. A 3rd option is to check out the Places to Visit in Florida Need some pointers.

Cheers.

Add comment

Powered by Viviti