I am looking for a way to disable a .toggle() attached to a div
if (condition) {
$("#div").toggle(
function() {
do this
},
function() {
do that
}
);
}
else {
// How do I achieve this?
$("#div").disableToggle(
);
}
More explanation:
This is a map application. The toggle in question is bound to an image button. The map loads at zoom level 4. The user zooms in, and the button in question becomes active only when the user is zoomed in more than zoom level 6. Once the user zooms out to less than level 6, I want the toggle button to become inactive again.
Why not just unbind the click?