Question: I have a simple code to display a div when hovering a div, like this below

```
$(".dhx_project").mouseenter(function(e) {
    $('.project-tooltip').css({
        left: e.pageX + 20,
        top: e.pageY
    });
});

```

My problem is when user try put the mouse on the "RIGHT-MOST" of the ".dhx-project" div, the hover div cannot be seen like this

[![enter image description here](https://i.stack.imgur.com/vTvY0.png)](https://i.stack.imgur.com/vTvY0.png)

Is there's a way to put a condition when user mouseenter on the right-most, the div will show on the left?

SAMPLE SNIPPET
<https://jsfiddle.net/johndavemanuel/2jxfLw1z/14/>

Answer: 
If you're using Python 3.5+, you can use type hint with the following decorator (which I adapted from @MartijnPieters's [typeconversion decorator](https://stackoverflow.com/a/50079753/6890912)) to enforce the type hints:

```
import functools
import inspect

def enforce_types(f):
    sig = inspect.signature(f)
    @functools.wraps(f)
    def wrapper(*args, **kwargs):
        bound = sig.bind(*args, **kwargs)
        bound.apply_defaults()
        args = bound.arguments
        for param in sig.parameters.values():
            if param.annotation is not param.empty and not isinstance(args[param.name], param.annotation):
                raise TypeError("Parameter '%s' must be an instance of %s" % (param.name, param.annotation))
        result = f(*bound.args, **bound.kwargs)
        if sig.return_annotation is not sig.empty and not isinstance(result, sig.return_annotation):
            raise TypeError("Returning value of function '%s' must be an instance of %s" % (f.__name__, sig.return_annotation))
        return result
    return wrapper

@enforce_types
def isPrime(i: float) -> bool:
    i = abs(int(i))
    if i == 2 or i == 1: 
        return True    
    if not i & 1: 
        return False
    for x in range(3, int(i**0.5) + 1, 2):
        if i % x == 0:
            return False
    return True

```

so that:

```
print(isPrime(1))
print(isPrime(1.0))

```

would both output `True`, but:

```
print(isPrime('one'))

```

would raise the following exception:

```
TypeError: Parameter 'i' must be an instance of <class 'float'>

```
So:

```
if not (type(i)==float or type(i)==int):
    print("Input wrong type")
    return None

```

Could be simplified to:

```
if not isinstance(i,(float,int)):
    print("Input wrong type")
    return None

```

Then do error message:

```
if not isinstance(i,(float,int)):
    raise TypeError('Your Text here') #You can do any error i do `TypeError` just for now.

```

Then to create own Error message:

```
class MyError(Exception):
    pass

```

Then here:

```
if not isinstance(i,(float,int)):
    raise MyError('Your Text here')

```

But I'll prefer to use `TypeError`, for doing errror