Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ko.bindingHandlers.toggleSlide= {
- init: function(element, valueAccessor) {
- // Initially set the element to be instantly visible/hidden depending on the value
- var value = valueAccessor();
- $(element).toggleSlide(ko.unwrap(value)); // Use "unwrapObservable" so we can handle values that may or may not be observable
- },
- update: function(element, valueAccessor) {
- // Whenever the value subsequently changes, slowly fade the element in or out
- var value = valueAccessor();
- ko.unwrap(value) ? $(element).slideDown('fast') : $(element).slideUp('fast');
- }
- };
- ////////////////////////////////////////
- then on my button I have
- click: filteredPageChoices
- //////////////////////////////////////
- then on the slide down element
- toggleSlide: filteredPageChoices
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement