Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type='text/javascript'>
- function CenterItem(theItem){
- var winHeight=$(window).height();
- var windowMiddle=winHeight/2;
- var itemMiddle=$(theItem).height()/2;
- var theMiddle=windowMiddle-itemMiddle;
- if(winHeight>$(theItem).height()){ //vertical
- $(theItem).css('top',theMiddle);
- } else {
- $(theItem).css('top','0');
- }
- }
- $(document).ready(function() {
- CenterItem('#second .bg');
- });
- $(window).resize(function() {
- CenterItem('#second .bg');
- });
- </script>
- <div id="second">
- <div class="story"><div class="bg"></div>
- </div> <!--.story-->
- </div> <!--#second-->
- #second .bg{
- background: url(images/logo.png) 50% 0 no-repeat fixed ;
- height: 380px;
- margin: 0 auto;
- padding: 0;
- position: absolute;
- background-position: center center;
- width: 960px;
- z-index: 200;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement