Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

452
Views
¿Cómo establecer el margen con jquery?

Yo estoy haciendo esto:

 var sId=id.toString(); var index=sId.substring(3); var mrg=index*221; var el=$(id); el.css('margin-left',mrg+'px'); and el.css('marginLeft',mrg+'px');

el es el elemento en el que quiero establecer el margen (recuperado correctamente) y mrg es el valor del nuevo margen

Si hago $ ('#test1').css('margin-left',200); o $('#test1').css('marginLeft',200); funciona en ambos sentidos, hay algo mal con la forma en que configuré la propiedad.

La forma correcta es var el=$('#'+id);

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

tratar

 el.css('margin-left',mrg+'px');
over 4 years ago · Santiago Trujillo Report

0

Establézcalo con un valor px. Cambiar el código como a continuación debería funcionar

 el.css('marginLeft', mrg + 'px');
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!