jquery - unknown reason for broken javascript button -
i have been building portfolio site quite while now, , have made use of few simple scripts. recently, of these scripts have stopped working.
for reference, here site: http://www.jcstudios.org
the meta link on bottom left hand side of page supposed bring login form in place of navigation menu , toggle , forth clicked. however, javascript button has broken. noticed happened not long after installing prettyphoto plugin site. if case messing scripts, find fix plugin 1 of plugins able achieve looking for. ideas why script stopped working?
here script, assure worked fine while before spontaneously breaking.
$('.togglemeta').toggle(function(){ $('.togglemeta').text('site nav') $('#meta').css('display', 'block'); $('#sitenav').css('display', 'none'); },function(){ $('.togglemeta').text('meta') $('#meta').css('display', 'none'); $('#sitenav').css('display', 'block'); })
currently, button broken , cannot figure out why.
you upgraded jquery, , in version 1.9.1, using now, toggle()
function used way deprecated , removed, , hides , shows elements.
you'll have create own toggle functionality instead :
$('.togglemeta').on('click', function(){ var state = $(this).data('state'); if (state) { $('.togglemeta').text('meta') $('#meta').css('display', 'none'); $('#sitenav').css('display', 'block'); }else{ $('.togglemeta').text('site nav') $('#meta').css('display', 'block'); $('#sitenav').css('display', 'none'); } $(this).data('state', !state); });
Comments
Post a Comment