Created
October 20, 2020 09:51
-
-
Save alt-karate/c868fb0d0d2ddba167803f84975efb55 to your computer and use it in GitHub Desktop.
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
//画像をテキストに置き換え | |
$(function(){ | |
$(".sp_text").each(function(i){ | |
var txt = $("img",this).attr("alt"); | |
$(this).attr("data-label", txt); | |
}); | |
}) |
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
<p class="sp_text"><img src="images/txt.png" alt="WebDesign Dackel" /></p> |
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
/* スマホ時画像のalt属性をテキスト化 */ | |
.sp_text:after { | |
content: attr(data-label); | |
} | |
.sp_text img { | |
display: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment