I’m developing the frontend for a website using Laravel as php-framework. I have an area with a few clickable divs, which, if logged in should redirect you to another page, and if not display a tooltip telling the user to log in first.
The tooltip is shown with jquery, like so:
$(".flip-container").click(function(){
$("div.login li .tooltip").fadeIn(200);
});
$(".flip-container .back").mouseout(function(){
$("div.login li .tooltip").fadeOut(200);
});
Now, when the user is logged in, this obviously should not happen, and .flip-container should have a link around it. I just use the laravel Auth:check method to check if the user is logged in or not:
@if (Auth::check())
So how do I stop the jquery from running if the user is logged in? Do I have to give .flip-container another name and assign the same css to it or is there another better way to do it? I don’t want the user to just go into the inspector and just change the class..
One way would be to separate the JS that does the tooltips into some file, and don’t include that file if the user is logged in.