开发者

How to make this toggle effect possible?

开发者 https://www.devze.com 2022-12-29 00:02 出处:网络
default condition alt text http://shup.com/Sh开发者_如何学Goup/330969/1104593215-My-Desktop.png After clicking on Sitemap link

default condition

alt text http://shup.com/Sh开发者_如何学Goup/330969/1104593215-My-Desktop.png

After clicking on Sitemap link

How to write HTML to get footer links after the sitemap tree upon clicking on Sitemap link?

alt text http://shup.com/Shup/330973/110459357-My-Desktop.png


Jquery show and hide are your friends. Or, an even easier solution is to use toggle!

$('#show_hide').click(function(){
  $("#links").toggle();
  return false;
});


Style the links and the sitemap in a layout that you desire, then add the following JavaScript (tag the sitemap with id #sitemap and the link with id #smLink):

function toggleSitemap() {
  var sitemap = document.getElementById('sitemap'),
      smLink  = document.getElementById('smLink');
  smLink.innerHTML = (smLink.innerHTML == 'Sitemap -') ? 'Sitemap +' : 'Sitemap -';
  sitemap.style.display = (smLink.innerHTML == 'Sitemap -') ? 'block' : 'none';
}
document.getElementById('smLink').addEventListener('click', toggleSitemap, false);
0

精彩评论

暂无评论...
验证码 换一张
取 消