If you want to use any  jquery snippet with ‘$’ inside of wordpress theme files you have to wrap it with:

jQuery(document).ready(function($) {

    // put your code here, 
    //now you can use a jquery snippet with '$' inside of wordpress theme files safety 

});