/*jQuery Common Scripts*/ // jQuery script to control display of pcmag header product guide nav flyout $(document).ready(function() { $('li.prodGuide a#more' ).hover ( function(e) { $('div#w_flyout').show('fast',function() { //$('div#w_flyout').addClass('clickable'); $('div#w_flyout').hover ( function(e) { $('div#w_flyout').show() }, function(e) { $('div#w_flyout').hide(); } ); }); }, function(e) { $('div#w_flyout').hide(); } ); }); // Move splashshot ribbon to value set in class attribute of #w_splashshot // class = "pnum"+position parameter. Set in ziffsplash tag. // Else left it where it is $(document).ready(function(){ if ($('#w_splashshotRibbon')) { if ($('#w_splashshotRibbon').attr('class')) { var pnum = $('#w_splashshotRibbon').attr('class'); var paraPosition = (pnum.substr(4, pnum.length)-1 ); var pCount = $('.articleCopy p').length; // alert ('pnum is: '+pnum+'\n paraPosition is: '+paraPosition+'\n pCount is: '+pCount); if (pCount > paraPosition) { $('#w_splashshotRibbon').insertAfter($('.articleCopy p:eq('+paraPosition+')')); } } } }); // jQuery Product Grid Scripts // Controls Striping of Specs section $(document).ready(function() { if ($('table.productCompare')) { $('table.productCompare tbody.specs tr:odd').addClass('odd'); $('table.productCompare tbody.specs tr:even').addClass('even'); } }); // Controls Toggle of Specs and Benchmarking Display $(document).ready(function() { var toggleMinus = '/images/bullet_toggle_minus.png'; var togglePlus = '/images/bullet_toggle_plus.png'; // toggle subhead var $subHead = $('table.productCompare tbody.specs th.rowHeader'); //$subHead.prepend('collapse this section'); $('img', $subHead).addClass('clickable') .click(function() { var toggleSrc = $(this).attr('src'); if ( toggleSrc == toggleMinus ) { $(this).attr('src', togglePlus) .parents('tr').siblings().fadeOut('fast') } else { $(this).attr('src', toggleMinus) .parents('tr').siblings().fadeIn('fast'); }; }); }); $(document).ready(function() { // Toggles "Restore Columns" button when columns have been deleted $('div.restoreColumn').css('display','none'); $('div.restoreColumn').addClass('clickable restoreColumn') .click(function() { $('table.productCompare td').fadeIn('fast'); $('table.productCompare th').fadeIn('fast'); $('div.restoreColumn').fadeOut('fast'); }); // Controls collapsing of product columns var toggleMinus = '../images/minus.png'; $('table.productCompare').each(function() { var $table = $(this); $('th.toggleColumn', $table).each(function(column) { $('img', $(this)).addClass('clickable') .click(function() { var toggleSrc = $(this).attr('src'); if ( toggleSrc == toggleMinus ) { // hide // $(this).attr('src', togglePlus); $(this).parent('th').fadeOut('fast'); $table.find('th').filter(':nth-child(' + (column + 1) + ')').fadeOut('fast'); $table.find('td').filter(':nth-child(' + (column + 1) + ')').fadeOut('fast'); $('div.restoreColumn').fadeIn('fast'); } }); }); }); });