d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Full Screen Background Image
Add Reply New Topic New Poll
Member
Posts: 6,420
Joined: Jan 27 2008
Gold: 1,327.99
Dec 5 2013 02:32pm
Hi guys, I am trying to find that on Google but it is pretty hard...

I want to have a fullscreen image background (using jQuery or whatever), but I want the code to be the most simple it could be. No slider, no gallery, nothing, just a simple fullscreen image (responsive would be great).

If someone know where I can find a tutorial about that or know how to do it, it would be helpful...
Member
Posts: 2,736
Joined: Nov 28 2009
Gold: 34.00
Dec 5 2013 03:05pm
Code
background: #A39976 url('http://wallpapers.wallbase.cc/rozne/wallpaper-152091.jpg') no-repeat fixed top center;

Look into CSS Backgrounds
Then look into CSS Responsive Media Queries

And you'll have everything you need.

This post was edited by Eagl3s1ght on Dec 5 2013 03:07pm
Member
Posts: 6,420
Joined: Jan 27 2008
Gold: 1,327.99
Dec 5 2013 05:06pm
Quote (Eagl3s1ght @ Dec 5 2013 09:05pm)
Code
background: #A39976 url('http://wallpapers.wallbase.cc/rozne/wallpaper-152091.jpg') no-repeat fixed top center;

Look into CSS Backgrounds
Then look into CSS Responsive Media Queries

And you'll have everything you need.


Thanks a lot for that answer, is it working on mobile devices as well ?

In general, what changes between this way to do it (only CSS) and using jQuery, just for one background image ?
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Dec 5 2013 06:20pm
I prefer
Code
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
Member
Posts: 6,420
Joined: Jan 27 2008
Gold: 1,327.99
Dec 5 2013 06:23pm
Quote (0n35 @ Dec 6 2013 12:20am)
I prefer
Code
html {
  background: url(images/bg.jpg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}


And what is the difference between this and doing it through jQuery ?
Member
Posts: 2,736
Joined: Nov 28 2009
Gold: 34.00
Dec 5 2013 07:24pm
Quote (Arnage @ 6 Dec 2013 02:23)
And what is the difference between this and doing it through jQuery ?


I suggest you scrap what anyone has told you about jQuery and having a background image on your website.

jQuery is a javascript library.
Javascript allow client-side scripts to interact with the user.

Now tell me why you want to use jQuery instead of CSS. Because I'm telling you that you do not use javascript to have a background image on your website.
Member
Posts: 6,420
Joined: Jan 27 2008
Gold: 1,327.99
Dec 5 2013 07:44pm
Quote (Eagl3s1ght @ Dec 6 2013 01:24am)
I suggest you scrap what anyone has told you about jQuery and having a background image on your website.

jQuery is a javascript library.
Javascript allow client-side scripts to interact with the user.

Now tell me why you want to use jQuery instead of CSS. Because I'm telling you that you do not use javascript to have a background image on your website.


Got it now, thank you :)
Member
Posts: 4
Joined: Dec 12 2013
Gold: 0.00
Dec 12 2013 11:54pm
You can do this also like this.

// CSS part

section:full-screen
{
float: none;
width: 100%;
height: 100%;
padding: 0;
margin: 0;
border: 0 none;
background-color: #fff;
}

// HTML part

<section id="fullscreen">
<img src="..." alt="Image"/>
</section>

Now your picture is displayed in a normal size on your webpage. If you click on the picture it will change to fullscreen.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll