I have made a page with two divs that cover the whole page, but using them one by one, by hiding and showing them in request.
In other words, I only see the one page, and when clicking button 1 some things hide and some others show, when clicking button 2 the opposite.
My code:
$(function() {
$('.boxes').click(function() {
var e = $(this).attr('id');
console.log(e);
if(e == 'Button1') {
$('#Div0').fadeIn(1000);
$('#Div1').fadeOut(1000);
}
else if(e == 'Button2') {
$('#Div0').fadeOut(1000);
$('#Div1').fadeIn(1000);
}
});
});
That works fine.
Now the problem is that this is not my landing page. I have a landing (home) page where someone can click a button depending on what he wants to see. And I would like to load the page with those divs but with the correct div showing.
Basically what I need is the same process, but with the buttons (button1 & button2) being in a different page. So the click loads the page and runs the script to load (show) the correct Div.
I was thinking that if I can get a variable (variable e) to get value when button click and pass that variable to the next page when loaded that would work. Any idea on how to do that?
Or any idea on a different way to make this work?