Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: michelled/jquery-ui
...
head fork: michelled/jquery-ui
Checking mergeability… Don't worry, you can still create the pull request.
  • 9 commits
  • 3 files changed
  • 0 commit comments
  • 2 contributors
View
58 tests/visual/panel/panel.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Panel Visual Test : Default</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css">
+ <script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.panel.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ var panel = $("#panel1").panel();
+
+ $("#icons").toggle(function() {
+ panel.panel("option", "icons", false);
+ }, function() {
+ panel.panel("option", "icons", $.ui.panel.prototype.options.icons);
+ });
+
+ $("#disable").toggle(function() {
+ panel.panel("disable");
+ }, function() {
+ panel.panel("enable");
+ });
+
+ $("#destroy").toggle(function() {
+ panel.panel("destroy");
+ }, function() {
+ panel.panel();
+ });
+ })
+ </script>
+</head>
+<body>
+
+<div id="panel1">
+ <h3><a href="#">Panel Header 1</a></h3>
+ <div>
+ Panel Content 1
+ </div>
+ <h3><a href="#">Panel Header 2</a></h3>
+ <div>
+ Panel Content 2
+ </div>
+ <h3><a href="#">Panel Header 3</a></h3>
+ <div>
+ Panel Content 3
+ </div>
+</div>
+
+<button id="icons">Icons</button>
+<button id="disable">Disable</button>
+<button id="destroy">Destroy</button>
+
+</body>
+</html>
View
13 themes/base/jquery.ui.accordion.css
@@ -1,4 +1,4 @@
-/* Accordion
+/* Accordion/Panel
----------------------------------*/
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
@@ -9,4 +9,13 @@
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
-.ui-accordion .ui-accordion-content-active { display: block; }
+.ui-accordion .ui-accordion-content-active { display: block; }
+
+.ui-panel .ui-panel-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-panel .ui-panel-li-fix { display: inline; }
+.ui-panel .ui-panel-header-active { border-bottom: 0 !important; }
+.ui-panel .ui-panel-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-panel-icons .ui-panel-header a { padding-left: 2.2em; }
+.ui-panel .ui-panel-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-panel .ui-panel-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-panel .ui-panel-content-active { display: block; }
View
111 ui/jquery.ui.panel.js
@@ -0,0 +1,111 @@
+/*
+ * jQuery UI Panel @VERSION
+ *
+ * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Panel
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function($) {
+
+$.widget("ui.panel", {
+
+ options: {
+ icons: {
+ header: "ui-icon-triangle-1-e",
+ headerSelected: "ui-icon-triangle-1-s"
+ }
+ },
+
+ _create: function() {
+ this.element.addClass("ui-panel ui-widget ui-helper-reset");
+
+ var self = this;
+ this.headers = this.element
+ .find("> li > :first-child,> :not(li):even")
+ .addClass("ui-panel-header ui-helper-reset ui-state-default ui-corner-all")
+ .bind("mouseenter.panel", function() {
+ if (self.options.disabled) {
+ return;
+ }
+ $(this).addClass('ui-state-hover');
+ })
+ .bind("mouseleave.panel", function() {
+ $(this).removeClass('ui-state-hover');
+ })
+ .bind("focus.panel", function() {
+ $(this).addClass('ui-state-focus');
+ })
+ .bind("blur.panel", function() {
+ $(this).removeClass('ui-state-focus');
+ })
+ .bind("click.panel", function(e) {
+ if (self.options.disabled) {
+ return;
+ }
+ self.click($(this));
+ return false;
+ });
+ this._createIcons();
+
+ this.headers
+ .next()
+ .addClass("ui-panel-content ui-helper-reset ui-widget-content ui-corner-bottom")
+ .hide();
+ },
+
+ destroy: function() {
+ $.Widget.prototype.destroy.apply(this, arguments);
+ this.element
+ .removeClass("ui-panel ui-widget ui-helper-reset")
+ .removeAttr("role");
+
+ this.headers
+ .unbind(".panel")
+ .removeClass("ui-panel-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
+ .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
+
+ this.headers.find("a").removeAttr("tabindex");
+ this._destroyIcons();
+ var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-panel-content ui-panel-content-active");
+ },
+
+ _setOption: function(key, value) {
+ $.Widget.prototype._setOption.apply(this, arguments);
+
+ if (key == "icons") {
+ this._destroyIcons();
+ if (value) {
+ this._createIcons();
+ }
+ }
+
+ },
+
+ _createIcons: function() {
+ var o = this.options;
+ if (o.icons) {
+ $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
+ this.headers.filter(".ui-state-active").find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
+ this.element.addClass("ui-panel-icons");
+ }
+ },
+
+ _destroyIcons: function() {
+ this.headers.children(".ui-icon").remove();
+ this.element.removeClass("ui-panel-icons");
+ },
+
+ click: function(header) {
+ header.toggleClass("ui-state-active ui-corner-top ui-corner-all")
+ .find(".ui-icon").toggleClass(this.options.icons.headerSelected).toggleClass(this.options.icons.header);
+ header.next().toggleClass("ui-panel-content-active").slideToggle("fast");
+ }
+});
+
+}(jQuery));

No commit comments for this range

Something went wrong with that request. Please try again.