app:shadowbox
  • Required Attributes (1)
  • Optional Attributes (2)
  • Examples (1)
  • Source code
Name Type Description Default value
src Unknown target src for the shadowbox Not specified
Back to menuExample: Simple Example

This is a simple example that uses the <app:shadowbox>. For more options, visit http://mjijackson.com/shadowbox/doc/usage.html

Click here to view
<app:shadowbox src="../../widgets/app_shadowbox/doc/Captn_wright.png" options="{overlayOpacity: 0.5}" title="Our Fearless Leader">
	Click here to view
</app:shadowbox>
  1 /*
  2  * This file is part of Appcelerator.
  3  *
  4  * Copyright (C) 2006-2008 by Appcelerator, Inc. All Rights Reserved.
  5  * For more information, please visit http://www.appcelerator.org
  6  *
  7  * Appcelerator is free software: you can redistribute it and/or modify
  8  * it under the terms of the GNU General Public License as published by
  9  * the Free Software Foundation, either version 3 of the License, or
 10  * (at your option) any later version.
 11  *
 12  * This program is distributed in the hope that it will be useful,
 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15  * GNU General Public License for more details.
 16  * 
 17  * You should have received a copy of the GNU General Public License
 18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 19  *
 20  */
 21 
 22 
 23 Appcelerator.Widget.Shadowbox =
 24 {
 25     getName: function()
 26     {
 27         return 'appcelerator shadowbox';
 28     },
 29     getDescription: function()
 30     {
 31         return 'The shadowbox widget wraps the Shadowbox library available at http://mjijackson.com/shadowbox/doc/usage.html';
 32     },
 33     getVersion: function()
 34     {
 35         return '1.0.1';
 36     },
 37     getSpecVersion: function()
 38     {
 39         return 1.0;
 40     },
 41     getAuthor: function()
 42     {
 43         return 'Hamed Hashemi';
 44     },
 45     getModuleURL: function ()
 46     {
 47         return 'http://www.appcelerator.org';
 48     },
 49     isWidget: function ()
 50     {
 51         return true;
 52     },
 53     getWidgetName: function()
 54     {
 55         return 'app:shadowbox';
 56     },
 57 	getActions: function()
 58 	{
 59 		return ['execute'];
 60 	},	
 61     getAttributes: function()
 62     {
 63 		var T = Appcelerator.Types;        
 64         return [{
 65             name: 'src',
 66             optional: false,
 67             description: "target src for the shadowbox"
 68         }, {
 69             name: 'title',
 70             optional: true,
 71             description: "title on the shadowbox"
 72         }, {
 73             name: 'options',
 74             optional: true,
 75             description: "options on the shadowbox"
 76         }];
 77     },
 78 	execute: function(id,params,data,scope)
 79 	{
 80 
 81 	},
 82 	compileWidget: function(params)
 83 	{
 84 		Shadowbox.setup($(params['id']),params['options']);
 85 	},
 86     buildWidget: function(element,parameters)
 87     {
 88         if (!parameters['options'])
 89         {
 90             parameters['options'] = {};
 91         }
 92         else
 93         {
 94             parameters['options'] = parameters['options'].evalJSON();
 95         }
 96 		parameters['options']['skipSetup'] = true;
 97 		parameters['options']['loadingImage'] = Appcelerator.WidgetPath + 'app_shadowbox/images/loading.gif';
 98 	    parameters['options']['overlayBgImage'] = Appcelerator.WidgetPath + 'app_shadowbox/images/overlay-85.png';
 99 
100 		Shadowbox.init(parameters['options']);
101 		
102 		html = '<a href="'+parameters['src']+'" id="'+parameters['id']+'">';
103 		html += Appcelerator.Compiler.getHtml(element);
104 		html += '</a>';
105 
106 		return {
107 			'presentation' : html,
108 			'position' : Appcelerator.Compiler.POSITION_REPLACE,
109 			'parameters': parameters,
110 			'wire' : true,
111 			'compile':true
112 		};
113     }
114 };
115 
116 Appcelerator.Widget.loadWidgetCSS("app:shadowbox","shadowbox.css")
117 Appcelerator.Widget.registerWithJS('app:shadowbox',Appcelerator.Widget.Shadowbox,["shadowbox-prototype.js", "shadowbox.js"]);
118