Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. events: function(){
  2.             var
  3.                 plus = 'input[name="zform_height_plus"]',
  4.                 minus = 'input[name="zform_height_moins"]';
  5.                
  6.             $("._height_button").bind('click', function() {
  7.                 var
  8.                     val = $(this).prev("input").val(),
  9.                     parent = $(this).parent("div"),
  10.                     next = parent.next(".zform:first"),
  11.                     textarea = $("textarea", $(next));
  12.  
  13.                 if (val >= sdz.initHeight) {
  14.                     textarea.css('height', val);
  15.                 }
  16.             });
  17.  
  18.             $("._height").bind("keypress", function (e) {
  19.                 if (e.type === 'keypress') {
  20.                     if (e.keyCode === 13){
  21.                         $(this).next("._height_button:first").trigger("click");
  22.                         return false;
  23.                     }
  24.                 }
  25.             });
  26.  
  27.             $(plus   ", "   minus).bind('click', function(){
  28.                 var
  29.                     parent = $(this).parent("div"),
  30.                     next = parent.next(".zform:first"),
  31.                     textarea = $("textarea", $(next)),
  32.                     nudge = 50,
  33.                     newHeight = 0;
  34.                    
  35.                     if ($(this).attr("name") === "zform_height_moins") {
  36.                         nudge = -50;
  37.                     }
  38.                    
  39.                     newHeight = textarea.height()   nudge;
  40.                     if (newHeight >= sdz.initialHeight) {
  41.                         textarea.css('height', newHeight);
  42.                     }
  43.             });
  44.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement