Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ko.bindingHandlers.toggleSlide= {
  2.     init: function(element, valueAccessor) {
  3.         // Initially set the element to be instantly visible/hidden depending on the value
  4.         var value = valueAccessor();
  5.         $(element).toggleSlide(ko.unwrap(value)); // Use "unwrapObservable" so we can handle values that may or may not be observable
  6.     },
  7.     update: function(element, valueAccessor) {
  8.         // Whenever the value subsequently changes, slowly fade the element in or out
  9.         var value = valueAccessor();
  10.         ko.unwrap(value) ? $(element).slideDown('fast') : $(element).slideUp('fast');
  11.     }
  12. };
  13.  
  14. ////////////////////////////////////////
  15.  
  16. then on my button I have
  17.  
  18. click: filteredPageChoices
  19.  
  20. //////////////////////////////////////
  21.  
  22. then on the slide down element
  23.  
  24. toggleSlide: filteredPageChoices
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement