I reload the paina the stopPropagation ();

0

Good morning, as I do to make a togo click event change classes or image with arrows below and above.

 $(document).ready(main);
   var contador = 1;

   function main() {
       $('.children_').click(function() {
           if (contador == 0) {
               $('nav').animate({
                   left: '-100%'
               });
               contador = 1;
               event.stopPropagation();
           }
           return false;
       });
       $('.menu_bar').click(function() {
           if (contador == 1) {
               $('nav').animate({
                   left: '0'
               });
               contador = 0;
           } else {
               contador = 1;
               $('nav').animate({
                   left: '-100%'
               });
           }
           return false;
       });
       $('.info').mouseover(function() {
           $(this).children('.datos').show();
           return false;
       });
       $('.info').mouseout(function() {
           $(this).children('.datos').hide();
           return false;
       });
   }
   $('.child').hide(); //Hide children by default
   $('.parent').children().click(function() {
       $(this).children('.child').slideToggle('slow');
       return;
   }).children('.child').click(function(event) {
       event.stopPropagation();
       return;
   });
   $('.child_2').hide(); //Hide children by default

   $('.parent_2').children().click(function() {
       $(this).children('.child_2').slideToggle('slow');
       return;
   }).children('.child_2').click(function(event) {
       event.stopPropagation();
       return;
   });

                

<nav>
  <ul class="parent">
  <a  class="children_ nohover" style=" top: 4%;left: -16%;margin-left: 91%;"><span class="icon-cross" style="color: #04223F; font-size: 20px;"></span></a>
    <li class="nohover"><a href="http://www.dominoprofesional.com/" ><img src="http://www.dominoprofesional.com/wp-content/uploads/2017/08/dominiogrup_logo_.png" style="width: 100%;">

    </a></li>

    <li class="submenu">
      <a  return ="false"><span ></span>UNIDADES DE NEGOCIO<span class="caret icon-arrow-down2"></span></a>
      <ul class="child parent_2">
        <li class="submenu2" style="background: #042240;">
          <a  style="-webkit-text-fill-color: #fff;">SOFTWARE ADAMINISTRATIVO Y CONTABLE <span class="caret icon-arrow-down2" style="top: 0px;"></span></a>
            <ul class="child_2" style="background: linear-gradient(#2BB2E1 , #005D91);">
              <li><a href="http://www.dominoprofesional.com/sac/"> Contabilidad<span class="icon-dot"></span></a></li>
              <li><a href="http://www.dominoprofesional.com/sac/">Tesoreria<span class="icon-dot"></span></a></li>
              <li><a href="http://www.dominoprofesional.com/sac/">Comercial<span class="icon-dot"></span></a></li>
            </ul>
          </li>
    
asked by Alexander Aguilar 18.09.2017 в 22:39
source

1 answer

1

The clicks you make them in anchors without stopping the main effect, that is, the recharge, try this way:


$('.parent').children().click(function(event) {
   event.preventDefault();
   ---- resto de codigo ---
});

with "preventDefault ()" you avoid the normal behavior of the anchor.

    
answered by 18.09.2017 в 23:09