Change layout according to each button [closed]

0

I've seen many sites that change background according to what the user chooses right?

However, would it be possible for me to change the content of the site according to the button that the user clicks?

Example: I have a page that displays a popup "Este acesso é pessoa física ou jurídica ?" If clicked Física displays a content, if clicked Jurídica the popup will be closed and the current content will be displayed.

>

I have halfway gone, I have the popup displaying the message, and if the user clicks jurídica the popup closes, if it clicks Fisíca redirects to a url.

Ps: I know it got really big, but I tried to go over every possible detail. I'm using BootStrap

LINK UP ON THE SITE

    
asked by anonymous 03.11.2016 / 19:51

2 answers

1

You can create the properties for both style classes in your style sheet (CSS) and change the class name using Javascript in real time.

var r = confirm("Cliquei:\nOK para Pessoa Físca\n CANCEL para Pessoa Jurídica");
if (r) {
    document.getElementById("formulario").className = "pf";
} else {
    document.getElementById("formulario").className = "pj";
}
.pf {
  background-color: red;
}

.pj {
  background-color: blue;
}
<div id="formulario">Formulário</div>
    
03.11.2016 / 20:10
0

When I access the page, I noticed that you use jQuery, which makes it much easier, as you already did the click treatment and could identify which user already clicked, I'll just put some methods that can help you:

To change the texts you can use the .text() ;

To add classes .addClass() and remove #

To change the CSS .removeClass() ;

To hide elements .css() to display .hide()

To remove .show()

Basically that's it, they're all simple and easy to use and I believe they'll meet your need.

    
03.11.2016 / 20:47