Hi anvina,
It will behave like the way you said because what happens is the request goes to server side and page gets postbacked so div which is used for background black screen appears and hide so there is no solution for it as an alternative what you can do is use BootStrap Tabs or jQuery Tabs which wont postback the page and if you want to call server side methods then you need to make ajax call for requests to avoid the postback which will ignore the hide and show of black screen.
For BootStrap Tabs refer below article.
For jQuery Tabs refer below article.