Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Oi, Amanda! Como você sabe, tô tentando aprender algumas coisinhas.
- /*neste codigo eu tentei utilizar o jQuery pra manipular o css de uma página.
- o objetivo era usar a propriedade transform dinamicamente com o js(jquery) para mostrar sections.
- Quando o usuario clica em um dos botões do menu, a section se apresenta com o translateX e uma setinha básica que eu fiz no Adobe PS
- aparece, só pra indicar que conteudo está sendo mostrado.
- Ao clicar denovo, no mesmo ou em outro botão do menu, a section ativa se esconde e a nova section target é transladada para aparecer.
- Esse trechinho é só isso mesmo. :x*/
- var divActive = null;
- $(document).ready(function(){
- //Funções dos botões do menu
- $("#menu button").click(function mostraDiv(){
- $(".seta").css({
- transform: "rotate(0deg) scale(0.6)"
- });
- var target = $(this).attr("id");
- if(divActive === null){
- $("#"+target+"Section").css("transform", "translateX(1140px)");
- $("#"+target+"Seta").fadeIn("slow");
- divActive = target;
- }
- else{
- $("#"+divActive+"Section").hide("slow");
- $("#"+divActive+"Section").css("transform", "translateX(-1140px)");
- $("#"+divActive+"Section").show("slow");
- $("#"+divActive+"Seta").css({
- transform: "rotate(-180deg)"
- });
- $("#"+divActive+"Seta").fadeOut("slow");
- if(divActive !== target){
- $("#"+target+"Section").css("transform", "translateX(1140px)");
- $("#"+target+"Seta").fadeIn("slow");
- divActive = target;
- }
- else if(divActive === target){
- divActive = null;
- }
- }
- });
- }
- //Obrigado pela atenção, Amandaaaa *O*
- //PS: Tá tudo errado? T____T
Add Comment
Please, Sign In to add comment