I have a div with a class and when the screen gets in 770px I have a code that changes that class. I would like to additionally change the class name to change it's position, display it in another div, how could I do it by jQuery?
Example
window.addEventListener('resize', function () {
var largura = window.innerWidth;
if (largura < 750)
document.getElementsByClassName('carrinho.desktop')[0].className = 'carrinho.mobile';
});
Then this cart.mobile I would 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 was:
$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());;
}
})