A video of this class is (or will be) posted at: http://echo360.uml.edu/heines201516/guiprogramming1.html
Grader #1 Comments
Grader #2 Comments
form element, but selecting the div which had the inputs which seemed to break the validator. $(document).ready(...); function.Grader #3 Comments
JMH Comments
I currently get the values from the user input and make sure that the start points are smaller than the end points, if not, swap them the user won’t know the difference and it will make the code run.
It should be needless to say that this is unacceptable. *Never* assume that “the user won’t know the difference.”
this value in JavaScript.
Related reading for this class: JS&jQ:TMM Ch. 9
Run the tabbed panels example that is built in the tutorial on pages 307-311 of JS&jQ:TMM. Browse the source code to see how everything fits together.
If you have the book’s sample programs on your system, you can find the completed tabbed panels tutorial at:
{Your-Book-Root-Directory}\MM_JAVASCRIPT2E\chapter10\complete_tabs.html
If you do not have these programs, you can download them from:
Alternatively, you can run this program from:
View the source code and look up any part of it that you don’t understand in the book.
runnable web page of the above code
The following built-in classes are use by the Tabs Widget Framework to style the individual components
For the outer container <div>
Classname Purpose ui-tabsAllows tab-specific structural CSS to be applied. ui-widgetSets generic font styles that are inherited by nested elements. ui-widget-contentProvides theme-specific styles. ui-corner-allApplies rounded corners to the container.
For the <ul> element within the container <div>
Classname Purpose ui-tabs-navAllows tab-specific structural CSS to be applied. ui-helper-resetNeutralizes browser-specific styles applied to <ul>elements.ui-helper-clearfixApplies the clear-fix as this element has children that are floated. ui-widget-headerProvides theme-specific styles. ui-corner-allApplies rounded corners.
For the individual <li> elements that form a part of the tab headings
Classname Purpose ui-state-defaultApplies the standard, non-active, non-selected, non-hovered state to the tab headings. ui-corner-topApplies rounded corners to the top edges of the elements. ui-tabs-selectedThis is only applied to the active tab. On page-load of the default implementation, this will be the first tab. Selecting another tab will remove this class from the currently selected tab and apply it to the newly selected tab. ui-state-activeApplies theme-specific styles to the currently selected tab. This class name will be added to the tab that is currently selected, just like the previous classname. The reason there are two class names is that ui-tabs-selectedprovides the functional CSS, whileui-state-activeprovides the visual, decorative styles.
For the panel elements that hold each tab’s content
Classname Purpose ui-tabs-panelApplies structural CSS to the content panels. ui-widget-contentApplies theme-specific styles. ui-corner-bottomApplies rounded corners to the bottom edges of the content panels.
Each components in the UI library also has a series of options that control the widget features hat are enabled by default.
tabs() widget method.
var tabOpts = { "selected" : tabToSelect } ; // 0-based
$("#tablabels").tabs( tabOpts ) ;
Option Default Value Used to... ajaxOptionsnullSpecify additional Ajax options. We can use any of the options exposed by jQuery’s $.ajax()method such asdata,type,url, and so on.cachefalseControl whether the remote data is loaded only once when the page initializes, or is reloaded every time the corresponding tab is clicked. collapsiblefalseAllow an active tab to be unselected if it is clicked, so that all of the content panels are hidden and only the tab headings are visible. cookienullShow the active tab using cookie data on page load. The cookie plugin is required for this option to be used. disabledfalseDisable the widget on page load. We can also pass an array of tab indices (zero-based) in order to disable specific tabs. event"click"Specify the event that triggers the display of content panels. fxnullSpecify an animation effect when changing tabs. Supply an object literal or an array of animation effects. idPrefix"ui-tabs-"Generate a unique ID and fragment identifier when a remote tab heading’s <a> element has no title attribute. panelTemplate"<div></div>"Specifying the elements used for the content section of a tab panel. selected0Show a tab panel other than the first one on page load (overrides the cookie property). spinner"Loading…"Specify the loading spinner for remote tabs. tabTemplate<li><a href="#{href}"> <span>#{label} </span> </a> </li>Specify the elements used when creating new tabs. The #{href}and#{label}strings are replaced by the widget internally when the new tab is created.
Various events are exposed by the tabs widget.
Event Fired when... addA new tab is added. disableA tab is disabled. enableA tab is enabled. loadA tab’s remote data has loaded. removeA tab is removed. selectA tab is selected. showA tab is shown. (function($){ var handleSelect = function(e, tab) { $( "<p></p>" , { "text": "Tab at index " + tab.index + " selected", "class": "status-message ui-corner-all" }).appendTo(".ui-tabs-nav", "#myTabs").fadeOut( 5000, function() { $(this).remove(); } ); } , tabOpts = { select: handleSelect } $("#myTabs").tabs(tabOpts); })(jQuery);
Binding to Tabs Widget Events (jQuery UI 1.8 by Dan Wellman, p. 74)
bind() method to bind an event handler to a custom event, fired by the tabs widget in the same way that we could bind to a standard DOM event, such as a click.
Event Fired when... tabsaddA tab has been added to the interface. tabsdisableA tab has been disabled. tabsenableA tab has been enabled. tabsloadA remote tab has loaded. tabsremoveA tab has been removed from the interface. tabsselectA tab is selected. tabsshowA tab is shown. (function($) { $("#myTabs").tabs(); $("#myTabs").bind("tabsselect", function(e, tab) { alert("The tab at index " + tab.index + " was selected"); }); })(jQuery);
The tabs widget also provides a rich set of methods that we can use to control its behavior programmatically.
Method Used to... abortStop any animations or Ajax requests that are currently in progress. addAdd a new tab programmatically, specifying the URL of the tab's content, a label, and optionally its index number as arguments. destroyCompletely remove the tabs widget. disableDisable a specific tab by passing a zero-based index number to the method, or pass nothing to the method to disable the entire set of tabs. enableEnable a disable tab by passing a zero-based index number to the method, or enable the entire widget by passing nothing to the method. lengthReturn the number of tabs in the widget. loadReload an Ajax tab’s content, specifying the index number of the tab. optionGet or set any property after the widget has been initialized. removeRemove a tab programmatically, specifying the index of the tab to remove. If no index is supplied, the first tab is removed. Tabs can also be removed using their hrefvalue.rotateAutomatically changes the active tab after a specified number of milliseconds have passed, either once or repeatedly. selectSelect a tab programmatically, which has the same effect as when a visitor clicks a tab, based on index number. urlChange the URL of content given to an Ajax tab. The method expects the index number of the tab and the new URL. See also load (earlier in this table). widgetReturn the element that the tabs()widget method is called on.
Simply add an href attribute to the underlying HTML
<li><a href="CourseDescriptionPanel.html">Information</a></li>
The Website
The HTML to set up the tabs widget interface
The modified CSS file to style the website as I wished