Background_resize

by Koubenec

HTML

<link href='http://fonts.googleapis.com/css?family=Ledger' rel='stylesheet' type='text/css'>
<script type="text/javascript">
/*
 * jQuery Backstretch
 * Version 1.2.7
 * http://srobbin.com/jquery-plugins/jquery-backstretch/
 *
 * Add a dynamically-resized background image to the page
 *
 * Copyright (c) 2012 Scott Robbin (srobbin.com)
 * Licensed under the MIT license
 * https://raw.github.com/srobbin/jquery-backstretch/master/LICENSE.txt
 * 
*/
;(function(a){a.backstretch=function(p,b,l){function s(){if(p){var b;0==c.length?c=a("<div />").attr("id","backstretch").css({left:0,top:0,position:m?"fixed":"absolute",overflow:"hidden",zIndex:-999999,margin:0,padding:0,height:"100%",width:"100%"}):c.find("img").addClass("deleteable");b=a("<img />").css({position:"absolute",display:"none",margin:0,padding:0,border:"none",zIndex:-999999}).bind("load",function(d){var b=a(this),e;b.css({width:"auto",height:"auto"});e=this.width||a(d.target).width();d=this.height||a(d.target).height();n=e/d;q();b.fadeIn(g.speed,function(){c.find(".deleteable").remove();"function"==typeof l&&l()})}).appendTo(c);0==a("body #backstretch").length&&(0===a(window).scrollTop()&&window.scrollTo(0,0),a("body").append(c));c.data("settings",g);b.attr("src",p);a(window).unbind("resize.backstretch").bind("resize.backstretch",function(){"onorientationchange"in window&&window.pageYOffset===0&&window.scrollTo(0,1);q()})}}function q(){try{j={left:0,top:0},rootWidth=h=o.width(),rootHeight=r?window.innerHeight:o.height(),f=h/n,f>=rootHeight?(k=(f-rootHeight)/2,g.centeredY&&(j.top="-"+k+"px")):(f=rootHeight,h=f*n,k=(h-rootWidth)/2,g.centeredX&&(j.left="-"+k+"px")),c.css({width:rootWidth,height:rootHeight}).find("img:not(.deleteable)").css({width:h,height:f}).css(j)}catch(a){}}var t={centeredX:!0,centeredY:!0,speed:0},c=a("#backstretch"),g=c.data("settings")||t;c.data("settings");var o,m,r,n,h,f,k,j;b&&"object"==typeof b&&a.extend(g,b);b&&"function"==typeof b&&(l=b);a(document).ready(function(){var...

CSS

#logoplace {
    width: 150px;
    height: 150px;
    background-image: url('http://summerallguardfoundation.org/wp-content/uploads/2012/10/Logo_head_150.png');
    margin-left: auto;
    margin-right: auto;
}

#navcontainer {
    height: 30px;
    width: 80%;
    background-color: white;
    margin: 5px auto;
    opacity: 1;
    border-left: solid 1px #414042;
    border-bottom: solid 1px #414042;
}

#rowone {
    width: 80%;
    height: 120px;
    background-color: transparent;
    margin: 5px auto;
}

#rowoneone {
    width: 50%;
    height: 120px;
    background-color: green;
    float: left;
    border-left: 0px solid #414042;
    border-bottom: 0px solid #414042;
}

#rowonetwo {
    width: 50%;
    height: 120px;
    background-color: blue;
    float: right;
    position: relative;
    left: 5px;
    border-left: 0px solid #414042;
}

#rowonewrapper {
    margin-right: 5px;
}

#rowtwo {
    width: 80%;
    height: 120px;
    background-color: #C1C1C1;
    margin: 5px auto;
    border-left: 1px solid #414042;
    border-bottom: 1px solid #414042;
}

html, body
{
    height: 100%;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.subtitle {
    font-size: 0.75em;
    font-family: 'Ledger', serif;
    color: #fff;
    margin-left: 10px;
}

.titleone {
    font-size: 1.5em;
    font-family: 'Ledger', serif;
    color: #fff;
    margin-left: 10px;
    text-shadow: -2px 2px 2px #414042;
}
    

/* Ticker Styling */
.ticker-wrapper.has-js {
    margin: 5px auto;
    padding: 0px 0px;
    width: 80%;
    height: 32px;
    display: block;
    background-color: #C29F52;
    font-size: 0.75em;
    font-family: 'Ledger', serif;
}
.ticker {
    width: 70%;
    height: 23px;
    display: block;
    position: relative;
    overflow: hidden;
    background-color: #C29F52;
    border-left: 1px solid #000;
}
.ticker-title {
    padding-top: 9px;
    color: #990000;
    font-weight: bold;
    background-color: #C29F52;
   ...

JavaScript

$(function(){
    $.backstretch("http://summerallguardfoundation.org/wp-content/uploads/2012/10/IMG_3585.jpg");
})
    
$(function () {
     // start the ticker 
    $('#js-news').ticker();
    
    // hide the release history when the page loads
    $('#release-wrapper').css('margin-top', '-' + ($('#release-wrapper').height() + 20) + 'px');

    // show/hide the release history on click
    $('a[href="#release-history"]').toggle(function () {    
        $('#release-wrapper').animate({
            marginTop: '0px'
        }, 600, 'linear');
    }, function () {
        $('#release-wrapper').animate({
            marginTop: '-' + ($('#release-wrapper').height() + 20) + 'px'
        }, 600, 'linear');
    });    
    
    $('#download a').mousedown(function () {
        _gaq.push(['_trackEvent', 'download-button', 'clicked'])        
    });
});

// google analytics code
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6132309-2']);
_gaq.push(['_setDomainName', 'www.jquerynewsticker.com']);
_gaq.push(['_trackPageview']);