onclick event href="" reloads page

I want to perform an animation and a content switch. I have the following code which works perfect outside of my yii2 application.

<script type="text/javascript">

    function goto(id, t){

                //animate to the div id.



                        {"left": -($(id).position().left)}, {

                    duration: 1000,

                    easing: 'easeInOutCubic'


                // add active class to the current link




<div class="slider_wrapper">

    <div class="slider_static-img"></div>

    <div class="slider_inner_slide">

        <a rel="nofollow" href="" onClick="goto('#slider_right_box', this); return false;" class="active">

            <div id="slider_left_box">

                <div id="slider_left"></div>



        <a rel="nofollow" href="" onClick="goto('#slider_left_box', this); return false;" class="active">

            <div id="slider_right_box">

                <div id="slider_right"></div>





But when I insert it to one of my views plus adding css and jquery + jquery ui it just reloads the page when I click on the shapes. What can be the problem? Does yii2 have a problem with empty href=""?

It sounds like there are JavaScript errors preventing the event from being intercepted. Check your browser’s console to see if errors are being reported when you load the page or when you click the link.

Absolutely correct. The problem is how jquery and jquery ui are loaded. yii loads the jquery.js at the end so putting it in the head with: (AppAsset.php) changes that

    public $jsOptions = array(

        'position' => \yii\web\View::POS_HEAD


Behind this in main.php

<?php $this->head() ?>

I have placed this

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

But it doesn’t seem to be a nice solution to get it on the road. Can I load jquery ui within the AppAsset? I saw that it is possible to install something equal via composer but I do not see where the effects shall be.