Ranga14

AtAuction.com Product Page JQuery Tab Highlight

Aug 14th, 2013
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.     // Product Page Tab Highlight
  3.     $(document).ready(function() {
  4.         $("#TabProductInfo li a").each(function() {
  5.             $(this).click(function() { 
  6.                 // Grab value of id attribute
  7.                 var vID = $(this).attr("id");
  8.                 // Find the id dynamically and find the current bg image of the hover state
  9.                 var hov = $("#" + vID + ":hover").css("background-image");
  10.                 // Set an inline style with the hover state's bg
  11.                 $(this).attr("style", "background-image: " + hov);
  12.                
  13.                 // After selecting a new tab, iterate through prior tabs and remove their bg images
  14.                 $("#TabProductInfo li").find("a").each(function() {
  15.                     sValue = $(this).attr("class");
  16.                     if (sValue != "selected") {
  17.                         $(this).removeAttr("style");
  18.                     }
  19.                 });
  20.             });
  21.         });
  22.     });
  23. </script>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×