-
-
Save stuartduff/6567512 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Options toggler hanlder | |
// To turn on/off other options base on toggler selection | |
function initOptionToggler() { | |
$(document).delegate('.yk-toggler', 'click', function(){ | |
var toggler_name = $(this).attr("name").replace("option_tree[","").replace("]",""); | |
var toggler_value = $(".yk-toggler[name*="+toggler_name+"]:checked").val(); | |
// Turn off all .yk-toggle-able fields | |
$(".yk-toggle-able[class*="+toggler_name+"]").parents(".format-settings").slideUp(); | |
// Turn on fields that relate with toggler's value | |
$("."+toggler_name+"-"+toggler_value).parents(".format-settings").slideDown(); | |
}); | |
setTimeout(function() {$(".yk-toggler:checked").click();}, 5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment