Good people,
I have the following problem: As the following image shows, I have a set of buttons to fast-forward and rewind the process sequence.
However,exactlyinthispart,Ineedtoclickonbotãonext
pageexpectsxsegundos
beforemovingforward.Ihavethefollowingcodetostoptheclickeventfromclickingthebuttonandtopushitforwardagain:
$('#btnnexttop,#btnnextdown').on('click',function(event){//sófuncionaquandootab4estveractivevartab4=$('#tab4').attr('class');varsvgShow=$('#capaemboss_laser').attr('class');varembossChosen=$('#dlemboss2_laser').val();//ImagensSVGcriarcomobtnnextemvezdopreviewif(svgShow=="row" && tab4 == "tab-pane active" && embossChosen != 'EMBOSS-D005') {
var btnclicked = $(this).attr('id');
//console.log(" teste" + btnclicked);
event.stopPropagation();
//obter o valor mais baixo do tamanho selecionado
var sizeVal = $("#dlformat2").val();
var withouI = sizeVal.replace(/\i/g, '');
var splitInt = withouI.split("x");
var minValue = Math.min.apply(Math, splitInt);
var pxValue = (minValue / 2) * 37.795276; // 37.795276 pixeis correspondem a 1cm! verificar!!
//novo texto para as imagens
var newText = $('#txt_emboss_laser').val();
var newText2 = $('#txt_emboss2_laser').val();
var newText3 = $('#txt_emboss3_laser').val();
var newText4 = $('#txt_emboss4_laser').val();
var svg_blob = "";
//obter id da imagem selecionada
var imgSelected = $('#dlemboss2_laser').val();
// por height igual ao pxValue
setTimeout(function () {
if (btnclicked == "btnnexttop") {
$('#btnnexttop').off('click').trigger('click');
} else if (btnclicked == "btnnextdown") {
$('#btnnextdown').off('click').trigger('click');
}
}, 1000);
}});
My idea was to use event.stopPropagation();
to stop the click event on the button and setTimeout
to trigger
of a new click.
Problem: The first click on each button next
(represented with ids: btnnextdown e btnnexttop
) works perfectly, however, if I go back and click again it stops working.