/ Published in: JavaScript
Expand |
Embed | Plain Text
$(document).ready(function() { var searchTerm = window.location.search.substring(4); if (searchTerm!="") $('#content').highlight(searchTerm); $('a[href^="http://purl.bms.com"]').attr("target","_blank"); $('.left-navheader a').click(function(e) { // disable default functionality, if there's expand/contract arrow (indicating sub-pages) if ($(this).parent().next().is('.left-navheader-contract, .left-navheader-expand')) e.preventDefault(); /* ID of the arrow image - ctl00_PlaceHolderLeftNavBar_idELPLeftNavigationUserControl_imgTD_4df9ee39-e0e4-4be0-9d12-62ff1a8d6a421 ID of the subnav DIV - ctl00_PlaceHolderLeftNavBar_idELPLeftNavigationUserControl_divNavigateCtrl_4df9ee39-e0e4-4be0-9d12-62ff1a8d6a421 */ // set cookie // - find ID of sibling ... i.e. the arrow image var fullImgID = $(this).parent().next().attr('id'); // - remove the prefix to find the part of the id we need ... var imgID = fullImgID.replace('ctl00_PlaceHolderLeftNavBar_idELPLeftNavigationUserControl_',''); // get just the unique part of the ID that's common to both the IMG and DIV var navID = imgID.replace('imgTD_',''); // - figure out the Subnav Div ID minus the prefix - since this is used as the cookie name, etc... var divID = 'divNavigateCtrl_'+navID; // figure out the ID of the div to toggle var fullSubnavID = 'ctl00_PlaceHolderLeftNavBar_idELPLeftNavigationUserControl_'+divID; // - set it, using plugin /* if ($(fullSubnavID).css('display')=="block") { $('#'+fullSubnavID).hide(); $.cookie(divID,"none", { path: '/'}); } else { $('#'+fullSubnavID).show(); $.cookie(divID,"block", { path: '/'}); } */ ShowHide(divID,imgID); }); });
You need to login to post a comment.
