I need a my character to jump and stay in air longer when clicked longer

How can I make my character jump like the game line runner??
Any helpful scripts for it??
If you press it a bit longer, it stays in air a bit longer…
Simple test scene would really help
For example, U have a plane and a cube. if you press the mouse it jumps and stays in the air for few seconds. But when released it has to come back down.
Can anyone help me with this??

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
    public float speed = 6.0F;
    public float jumpSpeed = 8.0F;
    public float gravity = 20.0F;
    public float airJump = 10.0f;
    private Vector3 moveDirection = Vector3.zero;
    void Update() {
        CharacterController controller = GetComponent<CharacterController>();
        if (controller.isGrounded) {
            moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
            moveDirection = transform.TransformDirection(moveDirection);
            moveDirection *= speed;
            if (Input.GetButtonDown("Jump"))
                moveDirection.y = jumpSpeed;
        } else {
            if (Input.GetButton("Jump"))
                moveDirection.y += airJump* Time.deltaTime;
        moveDirection.y -= gravity * Time.deltaTime;
        controller.Move(moveDirection * Time.deltaTime);

You would have to try it as I have not. This is taken from the CC page from Unity with one added line. The script checks if you are grounded and if you press space while grounded you jump. Now if you are in the air, not grounded, and you press jump, airJump is added to the moveDirection.y. In all cases, gravity is applied.

airJump simply reduces the gravity effect since it is smaller tan gravity. If you make airJump greater than you will start flying.

You could try it and report if it works as my logic is not infallible.