Changeset 1517
- Timestamp:
- 12/22/10 14:39:14 (2 years ago)
- Location:
- plugins/lightbox/js
- Files:
-
- 2 edited
-
jwplayer.lightbox.js (modified) (8 diffs)
-
test/index.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
plugins/lightbox/js/jwplayer.lightbox.js
r1516 r1517 6 6 7 7 8 var _options = options; 9 var _container = document.getElementById(options.id); 10 var _wrapper = document.createElement('div'); 8 var _container; 9 var _wrapper; 11 10 var _sheet; 12 11 var _preview; … … 14 13 var _image; 15 14 15 _wrapContainer(); 16 _drawSheet(); 17 _drawImage(); 18 _toggle(); 16 19 17 _css(_wrapper,{18 position: 'relative'20 jwplayer(options.id).onReady(function(playlist) { 21 this.play(); 19 22 }); 20 _css(_container, { 21 position: 'fixed', 22 zIndex: 999, 23 webkitBoxShadow:'0px 0px 10px #333', 24 MozBoxShadow:'0px 0px 10px #333' 25 }); 26 _wrap(_container,_wrapper); 27 _drawSheet(); 28 jwplayer().onPlaylist(function(playlist) { 29 var image = this.getPlaylistItem(0).image; 30 _css(_container,{ 31 left: Math.round(document.body.clientWidth/2 - this.getWidth()/2) + 'px', 32 top: Math.round(document.body.clientHeight/2 - this.getHeight()/2) + 'px' 33 }); 34 if(_preview) { 35 jwplayer().play(); 36 } else { 37 _drawImage(image); 23 24 25 function _css(element, styles) { 26 for (var style in styles) { 27 element.style[style] = styles[style]; 38 28 } 39 document.body.clientHeight 40 }); 29 }; 41 30 42 31 … … 44 33 _preview = document.createElement('div'); 45 34 _css(_preview,{ 46 height: _options.height+'px',47 width: _options.width+'px',35 height: options.height+'px', 36 width: options.width+'px', 48 37 border: '1px solid #CCC', 49 38 padding: '1px' … … 51 40 _wrapper.appendChild(_preview); 52 41 _image = document.createElement('img'); 53 _image.setAttribute('src', source);42 _image.setAttribute('src',options.image); 54 43 _css(_image,{ 55 height: _options.height+'px',56 width: _options.width+'px',44 height: options.height+'px', 45 width: options.width+'px', 57 46 display: 'block' 58 47 }); … … 67 56 position: 'absolute', 68 57 top: '0px', 69 width: _options.width+'px',70 height: _options.height+'px'58 width: options.width+'px', 59 height: options.height+'px' 71 60 }); 72 61 _wrapper.appendChild(_icon); … … 74 63 _toggle(); 75 64 } 76 _toggle();77 65 }; 78 66 … … 89 77 padding: '0px', 90 78 backgroundColor: '#000', 91 opacity: 0 .25,79 opacity: 0, 92 80 webkitTransitionProperty: 'opacity', 93 81 webkitTransitionDuration: '500ms', … … 106 94 _sheet.style.display = 'block'; 107 95 _container.style.display = 'block'; 96 _css(_sheet,{opacity:0.5}); 108 97 } else { 109 _sheet.style.display = 'none';110 98 _container.style.display = 'none'; 99 _css(_sheet,{opacity:0}); 100 setTimeout(_toggleTimeout,1000); 111 101 } 112 102 }; 113 103 114 104 115 function _wrap(element, wrapper) { 116 element.parentNode.replaceChild(wrapper,element); 117 wrapper.appendChild(element); 118 }; 105 function _toggleTimeout() { 106 _sheet.style.display = 'none'; 107 } 119 108 120 109 121 function _css(element, styles) { 122 for (var style in styles) { 123 try { 124 element.style[style] = styles[style]; 125 } catch (err) { 126 alert('applying style '+style+' failed'); 127 } 128 } 110 function _wrapContainer() { 111 _container = document.getElementById(options.id); 112 _wrapper = document.createElement('div'); 113 _css(_wrapper,{ 114 position: 'relative' 115 }); 116 _css(_container, { 117 position: 'fixed', 118 zIndex: 999, 119 webkitBoxShadow:'0px 0px 10px #333', 120 MozBoxShadow:'0px 0px 10px #333', 121 left: Math.round(document.body.clientWidth/2 - _container.clientWidth/2) + 'px', 122 top: Math.round(document.body.clientHeight/2 - _container.clientHeight/2) + 'px' 123 }); 124 _container.parentNode.replaceChild(_wrapper,_container); 125 _wrapper.appendChild(_container); 129 126 }; 130 127 -
plugins/lightbox/js/test/index.html
r1516 r1517 21 21 <script type="text/javascript"> 22 22 jwplayer("container").setup({ 23 file: 'http://content.bitsontherun.com/videos/nPripu9l-32 7.mp4',23 file: 'http://content.bitsontherun.com/videos/nPripu9l-329.mp4', 24 24 flashplayer: "jwplayer.swf", 25 height: 40 5,26 image:'http://content.bitsontherun.com/thumbs/nPripu9l- 480.jpg',25 height: 406, 26 image:'http://content.bitsontherun.com/thumbs/nPripu9l-720.jpg', 27 27 width: 720 28 28 }); 29 29 jwplayer.lightbox({ 30 height: 135, 30 31 id: 'container', 31 width: 240,32 height: 13532 image:'http://content.bitsontherun.com/thumbs/nPripu9l-320.jpg', 33 width: 240 33 34 }); 34 35
Note: See TracChangeset
for help on using the changeset viewer.
