JQuery UI not loading without explicit loading of jQuery

I know there are a lot of questions regarding this issue, but I can’t figure out mine here. I’m trying to load the whole jQuery UI ( Actually I need only the Slider ) and I successed. This is my enqueing which is working:

wp_enqueue_script('jquery-google-lib', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', array('jquery'), '2.1.4');
wp_enqueue_script('jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js', array('jquery'), '1.11.4');
wp_enqueue_style('jquery-ui-css-google-lib', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');

And this is the working various. When I check my head section, I can see I load jquery twice. I read the codex and says that WP loads jquery and jquery UI by default. Why I cannot use them and load them twice? When I remove the jquery enqueueing, jquery UI is not loading. Is it a good practice to load jquery from external sources? Why the wordpress jquery is in version 1.4.1 and google’s 2.1.4? When there are these libraries loaded, why can’t I use them in the front end? I got quite confused about this.

Solutions Collecting From Web of "JQuery UI not loading without explicit loading of jQuery"

jQuery and the jQuery UI Slider are both registered by default by WordPress. In order to use them, all you should need to do is something like this:

add_action( 'wp_enqueue_scripts', 'wpse192997_load_slider' );
function wpse192997_load_slider() {
    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'jquery-ui-slider' );

Note, though, that WordPress uses jQuery in noConflict mode, which means that the $ variable used in most jQuery code samples on the Internet won’t be available. You can get around that by using the techniques listed in the jQuery noConflict Wrappers section of the Codex article on wp_enqueue_script().