Keyboard pushing content up when opened

I’m using cordova keyboard plugin, and I’m trying to control the content pushed by it.
I’m having a comments page which has an input as a footer and comments depending on the event.

I would like to handle 2 scenarios:

  1. once I have maximum 5 comments (let’s say that half of the DOM is empty), I would like the keyboard push the input footer to the top of the keyboard but ONLY the footer and not the rest of the comments because that will cause the comments be out of screen.

  2. if I have mote than 5 comments, I would like the keyboard to have a normal behavior pushing all the content up as well the input footer.

*The second scenario seems to be the default behavior of the keyboard but I’m not sure how to handle the first one.
Thanks in advanced.