Skip to content

Instantly share code, notes, and snippets.

@jueyang
Created May 4, 2012 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jueyang/2597219 to your computer and use it in GitHub Desktop.
Save jueyang/2597219 to your computer and use it in GitHub Desktop.
How do i make the switcher and the in-text link independent from each other?
MB.layers = function(switcher, m, layers) {
$.each(layers, function(i, l) {
if (l.el) {
$('#' + l.el)
.click(function(e) {
e.preventDefault();
//('#' + switcher + ' .layer').removeClass('active');
$(this).addClass('active');
MB.refresh(m, l);
});
}
/* change something here?
if (switcher) {
$('#' + switcher).append($('<a href="#">' + l.name + '</a>')
.attr('id', 'layer-' + i)
.addClass('layer')
.click(function(e) {
e.preventDefault();
$('#' + switcher + ' .layer').removeClass('active');
$(this).addClass('active');
MB.refresh(m, l);
})
);
}*/
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment