I have the following code, whose objective is that when selecting a select option, open a colorbox with information. The problem that I present is that when you close the colorbox and select the same option again, the colorbox no longer opens, unless you choose another option different from the one already chosen.
<script type = "text/javascript">
$('select[name="acciones"]').change(function() {
var link = $(this).find(':selected').attr('href');
var link2 = $(this).find(':selected').attr('class');
if (link2 == "observaciones" || link2 == "correos" || link2 == "fechas") {
$.colorbox({
iframe: true,
width: "450px",
height: "300px",
href: link,
onOpen: function() {
$('body').css({
'overflow-y': 'hidden'
});
},
onClosed: function() {
$('body').css({
'overflow-y': 'auto'
});
}
});
} else {
$.colorbox({
iframe: true,
width: "800px",
height: "800px",
href: link,
onOpen: function() {
$('body').css({
'overflow-y': 'hidden'
});
},
onClosed: function() {
$('body').css({
'overflow-y': 'auto'
});
}
});
}
});
</script>
<select name="acciones">
<option disabled selected >Seleccione una acción</option>
<option class="opcion1" href="colorbox.php">Opcion 1</option>
<option class="opcion2" href="fechas.php">Opcion 2</option>
</select>
I would like to know what the problem is. Thanks