Skip to content

Instantly share code, notes, and snippets.

@procload
Created April 16, 2014 18:03
Show Gist options
  • Save procload/10914690 to your computer and use it in GitHub Desktop.
Save procload/10914690 to your computer and use it in GitHub Desktop.
# Checks to see if a tabbed URL corresponds to make it active
$url = $.url()
$anchor = $url.attr('anchor')
if $anchor.length > 0
$('.responsive-tab-item').removeClass 'tab-is-active'
$(".responsive-tabs li##{$anchor}").addClass("tab-is-active")
@jordanthomas
Copy link

$anchor = $("##{window.location.hash.slice(1)}")

if $anchor.length > 0
  $annchor.addClass('tab-is-active')

@procload
Copy link
Author

  # Checks to see if a tabbed URL corresponds to make it active
  tab = window.location.hash
  if tab != ""
    $('.responsive-tab-item').removeClass 'tab-is-active'
    $(tab).addClass("tab-is-active")

@jordanthomas
Copy link

$tab = $(window.location.hash)

if $tab.length
  $('.responsive-tab-item').removeClass 'tab-is-active'
  $tab.addClass("tab-is-active")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment