homepage Welcome to WebmasterWorld Guest from 23.22.173.58
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
JS only seems to work sometimes
warby12



 
Msg#: 4670884 posted 2:04 am on May 14, 2014 (gmt 0)

Hi, I've done this site: [michelleandandrew.net...]
and it has a full size fixed image background.
Unfortunately, the image doesn't seem to resize up to window size every time. On a control + F5 refresh the resize doesn't occur. Is this fixable?

 

Fotiman

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4670884 posted 1:30 pm on May 14, 2014 (gmt 0)

Try moving this to just before the closing </body> tag:

<script>
$.backstretch("images/beach-nsw.jpg");
</script>

birdbrain

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4670884 posted 3:21 pm on May 14, 2014 (gmt 0)

Hi there warby12,
you could, of course, just dump the javascript and use CSS instead. ;)


body {
font: 120%/1.4 'century gothic', verdana, arial, helvetica, sans-serif;
margin: 0;
padding: 0;
color: #1b1b1b;
background-color: #42413C;
background-image: url(images/beach-nsw.jpg);
background-repeat: no-repeat;
background-position: 0 0;
background-attachment: fixed;
background-size: 100% 100%;
}



birdbrain

Fotiman

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4670884 posted 3:40 pm on May 14, 2014 (gmt 0)

A CSS-only solution is good advice. Note, IE8 doesn't support background-size, so if you need to support that browser you won't be able to use CSS only. Also, you'll want to include -webkit-background-size for Android 2.1 - 2.3 support.

warby12



 
Msg#: 4670884 posted 11:39 pm on May 14, 2014 (gmt 0)

Thans All! I have it working pretty well now except in Iphone but I'm going to have to leave it there. I really appreciate your help!

rainborick

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4670884 posted 5:15 pm on May 15, 2014 (gmt 0)

You can add a lot of the popular CSS3 features to older versions of IE with CSS3 PIE [css3pie.com].

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved