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

133
Views
JS Pasando Parámetros Adicionales para Bind Callback

Tengo una función de devolución de llamada y me gustaría pasar parámetros. Leí que puede usar Aplicar, pero me pareció demasiado complejo y confuso. Aquí está mi función de enlace:

 function onPlotZoom (event, plot, args ) { $.each( plot.getAxes(), function( event, axisName, axis) { options[axisName].min = axis.min; options[axisName].max = axis.max; options[axisName].scale = axis.scale; } } $( "#plot" ).bind( "plotzoom", onPlotZoom );

Mi secuencia de comandos también tiene variables que escuchan en el documento, ya sea que se presione shift y ctrl y se almacenen así:

 var isShiftPressed = false; var isCtrlPressed = false;

¿Cómo puedo pasar estas 2 variables a la devolución de llamada en PlotZoom? He probado lo siguiente:

 $( "#plot" ).bind( "plotzoom", onPlotZoom( isShiftPressed, isCtrlPressed ) ); function onPlotZoom (event, plot, isShiftPressed, isCtrlPressed ) { $.each( plot.getAxes(), function( event, axisName, axis) { if(isShiftPressed) { //do stuff } if(isCtrlPressed) { // do stuff } options[axisName].min = axis.min; options[axisName].max = axis.max; options[axisName].scale = axis.scale; } }

otro método que probé fue usar argumentos y obtener la propiedad. Pero esto resultó en un error de propiedad 0 que no se puede encontrar:

 $( "#plot" ).bind( "plotzoom", onPlotZoom( isShiftPressed, isCtrlPressed ) ); function onPlotZoom (event, plot, args) { var isShiftPressed = args[0]; var isCtrlPressed = args[1]; // stuff }
about 4 years ago · Juan Pablo Isaza
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!