Team:UCLondon/Templates/Content-Slide
From 2012e.igem.org
(Difference between revisions)
Line 112: | Line 112: | ||
return false; | return false; | ||
}); | }); | ||
+ | |||
+ | |||
+ | var loading = ""; | ||
+ | |||
+ | |||
+ | jQuery.fn.center = function () { | ||
+ | var w = $(window); | ||
+ | var b = $('body'); | ||
+ | var mt = w.scrollTop() + (w.height() > b.height()) ? 0: ( -1 *Math.abs( w.outerHeight() - b.outerHeight() )/2 ); | ||
+ | this.css({ | ||
+ | 'position':'fixed', | ||
+ | 'left': '50%', | ||
+ | 'margin-left': 0 - (this.width() / 2), | ||
+ | 'top': '50%', | ||
+ | 'margin-top': (0 - (this.height() / 2)) | ||
+ | }); | ||
+ | return this; | ||
+ | } | ||
+ | |||
+ | |||
+ | var openBox = function () { | ||
+ | $('#shadow').center(); | ||
+ | var input = "<video id="CTPmediaElement0" class="CTPmediaElement" controls="" preload="auto" autoplay="" style="width: 1196px !important; height: 601px !important; " src="http://o-o---preferred---google-man2---v11---lscache7.c.youtube.com/videoplayback?upn=VHK5tgtZyY4&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&fexp=916404%2C908476%2C907519%2C920917%2C922401%2C920704%2C912806%2C913419%2C913558%2C913556%2C912706&ms=au&itag=18&ipbits=8&signature=710E6B1FCC3F55F7A9C802D71D6928BADC5D72E0.0AB364B95215DC71D121470EA68FE679A416CD2A&mv=m&sver=3&mt=1348034292&ratebypass=yes&source=youtube&expire=1348054364&key=yt1&ip=82.27.228.209&cp=U0hTTVBQUl9LTkNOM19ISlZEOmp1OGxQejVUa0NN&id=df21d1b2218dd6b6&newshard=yes&title=Elevator%20pitch%20draft.avi" poster="https://i.ytimg.com/vi/3yHRsiGN1rY/hqdefault.jpg"></video>"; | ||
+ | |||
+ | $('#shadow').toggle('slow', function() { | ||
+ | $(this).children('#box-content').html(input); | ||
+ | }); | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | var closeBox = function() { | ||
+ | $('#shadow').toggle('slow', function() { | ||
+ | $(this).children('#box-content').html(loading); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | $(document).ready(function(event) { | ||
+ | loading = $('#load').parent().html(); | ||
+ | |||
+ | $('body').off('click', '.button', openBox); | ||
+ | $('body').on('click', '.button', openBox); | ||
+ | |||
+ | $('body').off('click', '#close-box', closeBox); | ||
+ | $('body').on('click', '#close-box', closeBox); | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
</script> | </script> |
Revision as of 05:59, 19 September 2012