Created
February 6, 2012 19:08
-
-
Save juque/1754125 to your computer and use it in GitHub Desktop.
Show the image filename as a legend in modal window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Bootic.net | |
| * Show the image filename as a legend in modal window | |
| */ | |
| var showVariantName = (function(){ | |
| function getVariantName(url) { | |
| var reImg = /(\d+)-([^?]*)/; | |
| var reStripExt = /(.*)\.[^.]+$/; | |
| var reCleanName = /_+|-+/g; | |
| return url.split("/").pop().match(reImg)[2].match(reStripExt)[1].replace(reCleanName,' '); | |
| } | |
| $('#product-gallery li a').each(function(){ | |
| var newName = getVariantName(this.href); | |
| $(this).attr('title',newName); | |
| }) | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment