Difference between revisions of "Template:Freiburg/wiki content start"

 
(29 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<html>
 
<html>
 
<script>
 
 
$(document).ready(function(){
 
  var $blob = $("#upwards_blob"),
 
      $window = $(window),
 
      $pageheight = $(document).height()-$window.height();
 
 
    console.log('pageheight:'+$pageheight);
 
    console.log('windowwidth:'+$window.width());
 
    console.log('windowheight:'+$window.height());
 
 
    $(window).scroll(function(event) {
 
    console.log($(this).scrollTop()+'  pageheight:'+$pageheight);
 
    var y = $(this).scrollTop(),
 
        top = $(this).scrollTop() + $window.height() -100;
 
 
    // button disappears on top of the page //
 
    if (y <  60) {
 
      console.log('right in');
 
      $blob.css({"transform": "translateX(0)"}); // = 100 px outside
 
    }
 
 
    // button appears in the middle //
 
    if (y > 60 ) {
 
      console.log('right out');
 
      $blob.css({"transform": "translateX(-130px)"}); // = 30 px inside right
 
    }
 
 
 
    // if there is no lower background image, the button just moves upwards so it doesnt touch the footer
 
    if ($window.width() < 1320) { if (y > ($pageheight - 100)) {
 
      // blob stays 100px above bottom
 
      console.log("y 100 up");
 
    }} else if ($window.width() > 1320) { if (y > ($pageheight - 430)){
 
      console.log("y 430 up");
 
    }} else {
 
      $blob.css({"top": top });
 
    }
 
 
/*
 
    // if there is no lower background image, the button just moves upwards so it doesnt touch the footer //
 
    if ($window.width() < 1320) {
 
      if ($window.scrollTop() > ($pageheight-100)) {
 
        console.log('greater small');
 
        $blob.css({"transform":"translate(-110px, -100px)"});
 
      }
 
    }
 
 
    // if the lower background image is visible, the button moves upwards so it stays just above the image //
 
    else {
 
      if ($window.scrollTop() > ($pageheight-430)) {
 
        console.log('greater wide');
 
        $blob.css({"transform":"translate(-110px, 0)"});
 
        if ($window.scrollTop() > $pageheight-430) {
 
          console.log('blob should move up');
 
          $blob.stop().animate({
 
            bottom: $window.scrollTop() - $pageheight + 430 + topPadding
 
          });
 
        }
 
        else {
 
          $blob.stop().animate({
 
            bottom: 30
 
          });
 
        }
 
      }
 
    }
 
    */
 
  });
 
});
 
 
</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;
 
}
 
</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">

Latest revision as of 11:57, 11 September 2015