Ver Mensaje Individual
  #4 (permalink)  
Antiguo 23/06/2015, 04:46
mensajeescrito
 
Fecha de Ingreso: mayo-2012
Mensajes: 760
Antigüedad: 12 años, 9 meses
Puntos: 5
Respuesta: Expandir un input por el lado izquierdo

Bueno he encontrado una solucion por internet pero no entiendo por que en la web donde lo he encontrado funciona y cuando utilizo el codigo yo no funciona ¿?

Código CSS:
Ver original
  1. .pollSlider{
  2.     position:fixed;
  3.     height:100%;
  4.     background:red;
  5.     width:200px;
  6.     right:0px;
  7.     margin-right: -200px;
  8. }
  9. #pollSlider-button{
  10.     position:fixed;
  11.     width:100px;
  12.     height:50px;
  13.     right:0px;
  14.     background:green;
  15.     top:300px;
  16. }

Código Javascript:
Ver original
  1. $(document).ready(function()
  2. {
  3.   $('#pollSlider-button').click(function() {
  4.     if($(this).css("margin-right") == "200px")
  5.     {
  6.         $('.pollSlider').animate({"margin-right": '-=200'});
  7.         $('#pollSlider-button').animate({"margin-right": '-=200'});
  8.     }
  9.     else
  10.     {
  11.         $('.pollSlider').animate({"margin-right": '+=200'});
  12.         $('#pollSlider-button').animate({"margin-right": '+=200'});
  13.     }
  14.  
  15.  
  16.   });
  17.  });

<script src="js/jquery.min.js"></script>

Código HTML:
Ver original
  1. <div class="pollSlider"></div>
  2. <div id="pollSlider-button"></div>


Este es el enlace donde esta:

http://jsfiddle.net/XNnHC/942/