0
I have a div with a class and when the screen is at 770px I have a code that changes this class. I would like to not only change the name of the class change it of position, display it in another div, as I could do it by jQuery?
Example
window.addEventListener('resize', function () {
var largura = window.innerWidth;
if (largura < 750)
document.getElementsByClassName('carrinho.desktop')[0].className = 'carrinho.mobile';
});
So this.mobile cart I’d like to put inside another div, relocating it from place
Example of change
<div class="Onde a div está/Carrinho desktop">
<div class="classe que altera com o pixel"></div>
</div>
<div class="Para onde eu quero que vá a div/Carrinho mobile">
<div class="quando a classe alterar vir pra cá"></div>
</div>
If anyone wants to know how it turned out:
$j(window).resize(function() {
windowsize = $j(window).width();
if (windowsize <= 769) {
$j('.carrinho-cheio-mobile').replaceWith($j('.mini-cart-content.dropdown-content.left-hand.skip-content.skip-content-.-style.block-cart.block').clone());;
}
})
I don’t understand, explain it better, please.
– Wictor Chaves
I’ll rephrase the question.
– Gustavo Souza
See if you’ve gotten better to understand
– Gustavo Souza
From what I understand you want to change the form of a div according to certain resolution. But you want to do this by creating or removing the element itself and not css, I believe that a css code already solves your problem, to help would need more details.
– Wictor Chaves