I basically analysed the default behaviour of mobilyblocks.js file.
It was found that the js code internally creates a new anchor tag that is placed as a first child of the DIV tag ('menu_items'). css assigned to this tag is 'trigger'.
You just handled the click event for the parent tag, by assigning it a new css class. But because of this new anchor tag added, your piece of code was behaving differently. If you click on outer DIV tag ('switch') then only background images were getting changed. And nothing happened to the inner DIV, no events were triggered.
Hence I just changed the binding logic that two events must happen one by one. There are two possibilities of implementing the change -
1) outer DIV click event followed by inner DIV(anchor) click event
2) inner DIV(anchor) click event followed by outer DIV click event
While the previous solution was based on the second possibility, below is the logic for implementing the first possibility.
Code:
<script type="text/javascript">
$(document).ready(function() {
$('.menu_items').mobilyblocks({duration:500, zIndex:10, widthMultiplier:1.1});
$('.switch').click(function(){
if($('.switch').hasClass('menu_b'))
{$('.switch').addClass('menu_s').removeClass('menu_b');}
else
{$('.switch').addClass('menu_b').removeClass('menu_s');}
$('a.trigger').click();
});
});
</script>
Please note that the default behaviour of the menu is to handle the click event. As it also supports mouseover event, if you are changing this, you also need to change the click event to mouseover event.
Hope it clarifies everything...
Regards,
Niral Soni