Bootstrap nav dropdown issue

My navigation dropdown menu inst disappearing after clicking on a link.
http://myshirtbuzz.com/2016

Hi,

This is really a js question but you can try adding this to your scroll function which should do the trick.


$('.navbar-collapse li.dropdown').removeClass('open');

e.g. It goes in here:

// User define function
	function Scroll() {
		var contentTop      =   [];
		var contentBottom   =   [];
		var winTop      =   $(window).scrollTop();
		var rangeTop    =   200;
		var rangeBottom =   500;
		$('.navbar-collapse li.dropdown').removeClass('open');
		
		$('.navbar-collapse').find('.scroll a').each(function(){
			contentTop.push( $( $(this).attr('href') ).offset().top);
			contentBottom.push( $( $(this).attr('href') ).offset().top + $( $(this).attr('href') ).height() );
		})
		$.each( contentTop, function(i){
			if ( winTop > contentTop[i] - rangeTop ){
				$('.navbar-collapse li.scroll')
				.removeClass('active')
				.eq(i).addClass('active');			
			}
		})
	};

If that doesn’t work I’ll move the post to the JS forum for the experts to look at :slight_smile:

Works perfectly, Thanks again Paul

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.