I am working on a plugin. My plugin requires the javascript that I have created. It is working fine on Settings > My_Plugin_Option page which is part of my plugin but it breaks the JavaScript of WordPress on other pages.
Like if i move to posts and take mouse over to the Settings menu the sidebar submenu disappears. I checked to the console tab and it was because of my JavaScript file. This is how I used to load the my style and javascript files.
// $admin is the object of the Admin Class and enqueue_styles, enqueue_scripts are methods
$this->loader->add_action( 'admin_enqueue_scripts', $admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $admin, 'enqueue_scripts' );
I want to loading this style and javascript only only on Settings page.