Pregunta

I would like to cancel an exposed element and expose another one in one onClick(). Is that possible? My code doesn't work.. Here's the js:

function tutStep1(){
    jQuery('#workspace_menu').expose({
        onLoad: function(event) {
            jQuery('.next').fadeIn();
        }
    });

    jQuery('.tutorial .next').click(function() {
        jQuery.mask.close();
        tutStep2();
    });
});

function tutStep2(){
    jQuery('.action_list').expose();
}

Here's the html

<span onclick="tutStep1();" >tutorial</span>

The mask just won't open again unless I click on the span. Or is there another way by not closing the mask, and switch elements to expose?

¿Fue útil?

Solución

Probably not a good idea to put a click event inside a click event. I'm not familiar with this mask plugin, but speaking in the abstract, you can clean it up by doing something like this:

$('.open').click(function() {
   $('#workspace_menu').show();
});

$('.tutorial, .next').click(function() {
   $('.mask').hide();
   $('.action_list').show();
});

Make sure you separate multiple selectors with a comma in the case of .tutorial and .next

Otros consejos

You have your onClick events nested inside one another. Recode and keep them all separate.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top