Tizen 2.1 base
[platform/framework/web/web-ui-fw.git] / src / widgets / 020_huegradient / js / jquery.mobile.tizen.huegradient.js
1 (function($, undefined) {
2
3 $.widget("tizen.huegradient", $.tizen.widgetex, {
4     _create: function() {
5         this.element.addClass("tizen-huegradient");
6     },
7
8     // Crutches for IE: it is incapable of multi-stop gradients, so add multiple divs inside the given div, each with a
9     // two-point gradient
10     _IEGradient: function(div, disabled) {
11         var rainbow = disabled
12             ? ["#363636", "#ededed", "#b6b6b6", "#c9c9c9", "#121212", "#494949", "#363636"]
13             : ["#ff0000", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff", "#ff0000"];
14         for (var Nix = 0 ; Nix < 6 ; Nix++) {
15             $("<div></div>")
16                 .css({
17                     position: "absolute",
18                     width: (100 / 6) + "%",
19                     height: "100%",
20                     left: (Nix * 100 / 6) + "%",
21                     top: "0px",
22                     filter: "progid:DXImageTransform.Microsoft.gradient (startColorstr='" + rainbow[Nix] + "', endColorstr='" + rainbow[Nix + 1] + "', GradientType = 1)"
23                 })
24                 .appendTo(div);
25         }
26     },
27
28     _setDisabled: function(value) {
29         $.Widget.prototype._setOption.call(this, "disabled", value);
30         if ($.mobile.browser.ie)
31             this._IEGradient(this.element.empty(), value);
32     }
33 });
34
35 })(jQuery);