Export 0.1.61
[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                                 Nix;
15
16                         for (Nix = 0 ; Nix < 6 ; Nix++ ) {
17                                 $( "<div></div>" )
18                                         .css( {
19                                                 position: "absolute",
20                                                 width: ( 100 / 6 ) + "%",
21                                                 height: "100%",
22                                                 left: ( Nix * 100 / 6 ) + "%",
23                                                 top: "0px",
24                                                 filter: "progid:DXImageTransform.Microsoft.gradient (startColorstr='" + rainbow[Nix] + "', endColorstr='" + rainbow[Nix + 1] + "', GradientType = 1)"
25                                         } )
26                                         .appendTo( div );
27                         }
28                 },
29
30                 _setDisabled: function ( value ) {
31                         $.Widget.prototype._setOption.call( this, "disabled", value );
32                         if ( $.mobile.browser.ie ) {
33                                 this._IEGradient( this.element.empty(), value );
34                         }
35                 }
36         } );
37 }( jQuery ) );