jQuery.fn.extend({ live: function (event, callback) { if (this.selector) { jQuery(document).on(event, this.selector, callback); } return this; } }); jQuery(document).ready(function ($) { $('.list_of_functions_select').on('change',function () { var selected_id = $('.list_of_functions_select option:selected').data('selected'); var founded_value = $('.tab-content').find('.tab-pane#'+selected_id).html(); var founded_class = $('.tab-content').find('.active').html(); $('.tab-content .tab-pane').removeClass('active'); $('.tab-content .tab-pane').removeClass('show'); $('.tab-content').find('.tab-pane#'+selected_id).addClass('show'); $('.tab-content').find('.tab-pane#'+selected_id).addClass('active'); }); function showHashTargetTab() { //// tab switch function. this is Bootstrap $('#v-pills-tab a[href="'+window.location.hash+'"]').tab('show'); $('.package .sub-menu li').removeClass('active open'); $('.package .sub-menu a[href*="'+window.location.hash+'"]').parent('li').addClass('active open'); } $(document).on('click', '#myTab a[data-toggle="tab"]', function (e) { e.preventDefault(); window.location.hash = $(this)[0].hash; //// tab switch function. this is Bootstrap again $(this).tab('show'); }); // this happens on load, we check if the hash exists and if it is show the specific tab, otherwise show default tab if(window.location.hash) { showHashTargetTab(); $("html, body").animate({ scrollTop: $($(this).attr("href")).offset().top(-150) }, 500); } else { //// tab switch function. this is Bootstrap again $('#v-pills-tab a[data-toggle="tab"]:first').tab('show'); } // we need to know when we change the hash to show the specific tab $(window).on('hashchange', function(e) { e.preventDefault(); showHashTargetTab(); }); $('.panel.panel-default.function_panel .panel-title a').on('click',function (e) { e.preventDefault(); if($(this).hasClass('collapsed')){ $(this).find('.readFaq').hide(); $(this).find('.closeFaq').show(); }else{ $(this).find('.readFaq').show(); $(this).find('.closeFaq').hide(); } }); $('.searchedFaqValue .panel-title a').on('click',function (e) { e.preventDefault(); if($(this).hasClass('collapsed')){ $(this).find('.readFaq').show(); $(this).find('.closeFaq').hide(); }else{ $(this).find('.readFaq').hide(); $(this).find('.closeFaq').show(); } }); var ajaxurl = '/wp-admin/admin-ajax.php'; $('.search_functions').on('keyup',function (e) { e.preventDefault(); search_functions_ajax(); }); $('.search_functionsBtn').on('click',function (e) { e.preventDefault(); search_functions_ajax(); }); function search_functions_ajax() { var search_value = $('.search_functions').val(); var ids = []; if(search_value.length > 2){ $.ajax({ type: "POST", url: ajaxurl, data: { action: 'search_functions', search_value: search_value, }, beforeSend: function () { $('.searchedFaqValue').prepend('

Söker..

'); }, success: function (result) { $('.searchedFaqValue').html(''); $('.searchedFaqValue').prepend(result).fadeIn("slow"); } }); }else{ $('.searchedFaqValue').html(''); } } $('#my-user').attr('placeholder', 'Användarnamn..'); $('#my-pass').attr('placeholder', 'Lösenord..'); $('.dokumentbankForm .login-remember input').attr('data-toggle', 'toggle'); $('.dokumentbankForm .login-remember input').attr('data-on', ' '); $('.dokumentbankForm .login-remember input').attr('data-off', ' '); $('.dokumentbankForm .login-remember input').attr('data-style', 'ios'); var windowWidth = jQuery(window).width(); if(windowWidth <= 1500){ jQuery('video').attr('style','width:1500px!important'); jQuery('#wrapper8').attr('style','margin-left:-'+(1500 - windowWidth)/2+'px;overflow:hidden;'); }else{ jQuery('video').attr('style','width:100%!important'); jQuery('#wrapper8').attr('style','margin-left:auto;overflow:inherit;'); } }); jQuery(window).resize(function($) { var windowWidth = jQuery(window).width(); if(windowWidth <= 1500){ jQuery('video').attr('style','width:1500px!important'); jQuery('#wrapper8').attr('style','margin-left:-'+(1500 - windowWidth)/2+'px;overflow:hidden;'); }else{ jQuery('video').attr('style','width:100%!important'); jQuery('#wrapper8').attr('style','margin-left:auto;overflow:inherit;'); } });