S
S
Sergey Kravchenko2016-07-12 17:32:20
JavaScript
Sergey Kravchenko, 2016-07-12 17:32:20

How to open tab using anchor?

Good day to all. The problem is the following, we have tabs made through a bootstrap script. Each of them has its own ID. and you need to be able to open these tabs using their anchors. The site on which this was done is masterchast.ru/uslugi/proektirovanie-inzhenernyh-sistem and here it is necessary that, for example, with such a url masterchast.ru/uslugi/otoplenie/#da4a , we opened the 4th tab of the dacha take.ms/ QrEzE yu Maybe someone faced this problem and knows how to solve it, tell me please

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yarkov, 2016-07-12
@Vinnica

Something like this

(function($) {
    $(function() {
        var hash = window.location.hash;
        $('#myTab a[href="#' + hash + '"]').parent().get( 0 ).toggleClass('active');
    })
})(jQuery)

D
dev400, 2016-07-12
@dev400

read location.hash and open tab

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question