I have a members page setup which only shows a picture and login button if members are not logged in, so when members do log themselves in, then the login button reverts to a logout button and a members only strip is shown which contains all of the members only bits for that page like recent blog/forum posts and buttons to other member pages etc.
This members only strip is collapsed if members are not logged in and I have another strip called footer strip that is in position so that when the login button shows login then it is shown on page and the footer should be lined up underneath this footer strip.
With the members only strip being collapsed, then this should get rid of the empty white space that is currently shown when nobody has logged in yet and the footer should be positioned at the bottom of the footer strip which when viewed on desktop or mobile would be at the bottom of the screen and not at the bottom of the members only strip.
However, even with the code all set out as below and with the members only strip being collapsed until members log themselves in, I can’t get the footer to move up to be underneath the footer strip, I can only get the footer up to the bottom of the members only strip and it won’t move up any further.
So am I assuming that the footer on any page can only be moved up to whatever is the lowest item on the page?
Or does anybody know of a way in which I can get this collapsed members only strip to allow the footer to move up above it so that it rests underneath the footer strip.
Thanks if anybody can for me.
Code used on page:
// For full API documentation, including code examples, visit http://wix.to/94BuAAs
$w.onReady(function () {
//TODO: write your page related code here...
});
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady( () => {
if(wixUsers.currentUser.loggedIn) {
$w("#loginbutton").label = "Logout";
$w("#membersareaonlystrip").expand();
$w("#whitegapforfooter").hide();
}
else {
$w("#loginbutton").label = "Login";
$w("#membersareaonlystrip").collapse();
$w("#whitegapforfooter ").show();
}
} );
export function loginbutton_onclick(event) {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w("#loginbutton").label = "Login";
$w("#membersareaonlystrip").collapse();
$w("#whitegapforfooter ").show();
} );
}
// user is logged out
else {
let userId;
let userEmail;
// prompt the user to log in
wixUsers.promptLogin( {"mode": "login"} )
.then( (user) => {
userId = user.id;
return user.getEmail();
} )
.then( (email) => {
// check if there is an item for the user in the collection
userEmail = email;
return wixData.query("Members")
.eq("_id", userId)
.find();
} )
.then( (results) => {
// if an item for the user is not found
if (results.items.length === 0) {
// create an item
const toInsert = {
"_id": userId,
"email": userEmail
};
// add the item to the collection
wixData.insert("Members", toInsert)
.catch( (err) => {
console.log(err);
} );
}
// update buttons accordingly
$w("#loginbutton").label = "Logout";
$w("#membersareaonlystrip").expand();
$w("#whitegapforfooter").hide();
} )
.catch( (err) => {
console.log(err);
} );
}
}
export function profilebutton_onclick(event) {
wixLocation.to(`/Members/${wixUsers.currentUser.id}`);
}
export function entermembersbutton_onclick(event) {
wixLocation.to(`/members-area`);
}
export function myaccountbutton_onclick(event) {
wixLocation.to(`/account/my-account`);
}
export function websiteupdatebutton_onclick(event) {
wixLocation.to(`/website-update`);
}