|
|
Line 1: |
Line 1: |
| <html> | | <html> |
− |
| |
− | <!-- UPWARDS BLOB JQUERY -->
| |
− |
| |
− | <script>
| |
− |
| |
− | // The upwards-blob div is defined in Freiburg/CSS as its absolute position should be initialized on the top of the page
| |
− |
| |
− | $(document).ready(function(){
| |
− | var $blob = $("#upwards_blob"),
| |
− | $window = $(window),
| |
− | $doc_heighttop = $(document).height() - $window.height();
| |
− |
| |
− | //console.log('windowwidth:'+$window.width());
| |
− | //console.log('windowheight:'+$window.height());
| |
− | if ($doc_heighttop > $window.height()) {
| |
− | $(window).scroll(function(event) {
| |
− |
| |
− | // y is scroll progress (distance from top)
| |
− | // top is about bottomline of window
| |
− | var y = $(this).scrollTop(),
| |
− | top = $(this).scrollTop() + $window.height() -100;
| |
− | //console.log($(this).scrollTop()+' doc_heighttop:'+$doc_heighttop+' top:'+top);
| |
− |
| |
− | // use CSS transform to move button into view when user scrolls down
| |
− | if (y > 60 ) {
| |
− | console.log('blob inside');
| |
− | $blob.css({"display":"inline", "transform": "translateY(0)"}); // = 30 px inside right
| |
− | }
| |
− |
| |
− | // move blob out of view when page is scrolled up again
| |
− | if (y < 60) {
| |
− | console.log('blob outside');
| |
− | $blob.css({"transform": "translateY(130px)"}); // = 100 px outside
| |
− | }
| |
− |
| |
− | $blob.css({"top": top });
| |
− | });
| |
− | }
| |
− | });
| |
− |
| |
− | </script>
| |
− |
| |
− | <!-- LIGHTBOX EFFECT -->
| |
− | <!-- from http://webdesign.tutsplus.com/articles/super-simple-lightbox-with-css-and-jquery--webdesign-3528 -->
| |
− | <style>
| |
− |
| |
− | #lightbox {
| |
− | position:fixed; /* keeps the lightbox window in the current viewport */
| |
− | top:0;
| |
− | left:0;
| |
− | width:100%;
| |
− | height:100%;
| |
− | background: rgba(0,0,0,.7);
| |
− | text-align:center;
| |
− | z-index: 9999;
| |
− | }
| |
− |
| |
− | #lightbox p {
| |
− | text-align:right;
| |
− | color:#fff;
| |
− | margin-right:20px;
| |
− | font-size:12px;
| |
− | }
| |
− |
| |
− | #lightbox img {
| |
− | box-shadow:0 0 25px #111;
| |
− | -webkit-box-shadow:0 0 25px #111;
| |
− | -moz-box-shadow:0 0 25px #111;
| |
− | max-width:940px;
| |
− | max-height: 800px;
| |
− | }
| |
− | </style>
| |
− |
| |
− | <script type="text/javascript">
| |
− | $(document).ready(function(){
| |
− | $('.lightbox_trigger').click(function(event) {
| |
− |
| |
− | //prevent default action (hyperlink)
| |
− | event.preventDefault();
| |
− |
| |
− | //Get clicked link href
| |
− | var image_href = $(this).attr("href");
| |
− | console.log(image_href)
| |
− |
| |
− | /*
| |
− | If the lightbox window HTML already exists in document,
| |
− | change the img src to to match the href of whatever link was clicked
| |
− |
| |
− | If the lightbox window HTML doesn't exists, create it and insert it.
| |
− | (This will only happen the first time around)
| |
− | */
| |
− |
| |
− | if ($('#lightbox').length > 0) { // #lightbox exists
| |
− |
| |
− | //place href as img src value
| |
− | $('#lightboxcontent').html('<img src="' + image_href + '" />');
| |
− |
| |
− | //show lightbox window - you could use .show('fast') for a transition
| |
− | $('#lightbox').show('fast');
| |
− | }
| |
− |
| |
− | else { //#lightbox does not exist - create and insert (runs 1st time only)
| |
− |
| |
− | //create HTML markup for lightbox window
| |
− | var lightbox =
| |
− | '<div id="lightbox">' +
| |
− | '<p>Click to close</p>' +
| |
− | '<div id="lightboxcontent">' + //insert clicked link's href into img src
| |
− | '<img src="' + image_href +'" />' +
| |
− | '</div>' +
| |
− | '</div>';
| |
− |
| |
− | //insert lightbox HTML into page
| |
− | $('body').append(lightbox);
| |
− | }
| |
− |
| |
− | });
| |
− |
| |
− | //Click anywhere on the page to get rid of lightbox window
| |
− | $('body').on('click', '#lightbox', function() { //must use live, as the lightbox element is inserted into the DOM
| |
− | // as live is deprecated, use on
| |
− | $('#lightbox').hide();
| |
− | });
| |
− |
| |
− | });
| |
− | </script>
| |
− |
| |
− |
| |
| | | |
| <div class="content_background_wrapper"> | | <div class="content_background_wrapper"> |