[Solved] turn this jquery into an if/else statement [closed]
Let’s break this into bare parts, and fix the indentation. Then use some static analysis to compact the if statements. <!–script for changing Number of Columns–> $(window).load(function(){ function oneColumnClick() { $(‘.IH_pINameRow’).removeClass(“floatLeft “); $(‘.IH_pINameRow’).addClass(“floatNone “); $(‘.odd’).removeClass(“leftMargin”); $(‘.even’).removeClass(“rightMargin “); $(‘.pI_nameText’).removeClass(“textAlignLeft textAlignRight”); $(‘.pI_nameText’).css(‘font-size’, ‘2em’); $(‘.pI_nameText’).addClass(“1col”); $(‘.pI_nameText’).removeClass(“2col”); $(‘label.twoColumn’).css(‘background-position’, ‘-104px -52px’); $(‘label.oneColumn’).css(‘background-position’, ‘-104px -26px’); } function twoColumnClick() { $(‘.IH_pINameRow’).removeClass(“floatNone “); … Read more