Created
March 1, 2019 00:03
-
-
Save carmoreira/12871f6acb7c37df4bc3da964ac9e9f4 to your computer and use it in GitHub Desktop.
correct url of custom link field - team showcase
This file contains 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
jQuery(document) | |
.ready(function() { | |
ts_fix_url(".tshowcase-box-info"); | |
ts_fix_url(".tscontent"); | |
}) | |
.ajaxSuccess(function() { | |
ts_fix_url(".tshowcase-box-info"); | |
ts_fix_url(".tscontent"); | |
}); | |
function ts_fix_url(selector) { | |
jQuery(selector).each(function() { | |
var container = jQuery(this).find(".ts-link"); | |
var url = container.find("a").attr('href'); | |
var icon = url.slice(0,28); | |
var link = url.slice(28); | |
container.find("a").attr('href',link).parent().prepend(icon); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment