[help] User selected background

Dobby

Member
Nov 8, 2010
156
5
I'm trying to allow a user to select a background of their choice when they login but i am not sure how to do this.

I have already set backgrounds to choose from and i have a bg colum with a default of 1 in my table but i am not sure how to tell my database how to work with it.

WHat im trying to do:

if bg = 1 then default background
if bg = 2 then tree background
if bg = 3 then cat background

That is what i am after. When someone is not logged in i would like it to be the default background until they login and then for it to change to the background they chose earlier once logged in.

Make any sense?
 

LeChris

https://habbo.codes/
Sep 30, 2013
2,786
1,395
I'm trying to allow a user to select a background of their choice when they login but i am not sure how to do this.

I have already set backgrounds to choose from and i have a bg colum with a default of 1 in my table but i am not sure how to tell my database how to work with it.

WHat im trying to do:

if bg = 1 then default background
if bg = 2 then tree background
if bg = 3 then cat background

That is what i am after. When someone is not logged in i would like it to be the default background until they login and then for it to change to the background they chose earlier once logged in.

Make any sense?
What I did wasn't exactly the best, but I had it load a totally different CSS style sheet for each bg...it was simple lmfao
 

Ecko

23:37 [autobots] -!- eckostylez [[email protected]]
Nov 25, 2012
1,398
962
What I did wasn't exactly the best, but I had it load a totally different CSS style sheet for each bg...it was simple lmfao
that's dumb

keep default bg in css file (for non logged in users). then run an if statement for when they are logged in to see which bg they have selected. overwrite the default bg within that if statement to select the one they have chosen.
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
Use some jQuery to do this, once an element has been clicked it'll overwrite the css and change it to the correct background-image.

Here's a basic example, I'm sure you can work out how to implement it:
Code:
$("#button").click(function() {
    $('body').css("background-image", "url('newimage.png')");
});
 

Users who are viewing this thread

Top