Widget:PhotoTabs: Difference between revisions
From Unforgotten Realms Wiki
Jump to navigationJump to search
imported>Pillowkeeper No edit summary |
imported>Pillowkeeper No edit summary |
||
| Line 40: | Line 40: | ||
for (i = 0; i < series.length; i++) { | for (i = 0; i < series.length; i++) { | ||
$('#tabs').append('<a class="button" onclick="change(id)" id="' + series[i].name + '" ">' + series[i].name + '</a>'); | $('#tabs').append('<a class="button" onclick="change(id)" id="' + series[i].name + '" ">' + series[i].name + '</a>'); | ||
} | } | ||
for (i = 0; i < series.length; i++) { | for (i = 0; i < series.length; i++) { | ||
$("#tabs .button:last").after("<img class='pics' align='center' id='" + series[i].name + "' src='" + series[i].source + "' width='" + series[i].width + "' height='" + series[i].height + "'>"); | |||
$("#tabs .button:last").after("<img align='center' id='" + series[i].name + "' src='" + series[i].source + "' width='" + series[i].width + "' height='" + series[i].height + "'>"); | |||
} | } | ||
$(".pics").hide(); | |||
$("#" + series[0].name).show(); | |||
function change(id) { | function change(id) { | ||
| Line 59: | Line 56: | ||
} | } | ||
document.getElementById(id).style.backgroundColor = "#89540F"; //darker | document.getElementById(id).style.backgroundColor = "#89540F"; //darker | ||
$(".pics").hide(); | |||
$("#" + id).show(); | |||
} | } | ||
</script> | </script> | ||
Revision as of 04:08, 5 May 2017
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.0.min.js"></script>
<img id="pic" align="middle"> <style>
.button {
color: white;
border: 1px solid #64320d;
background-color: #b36e14;
font-family: "Arial";
letter-spacing: .5px;
padding: 5px;
text-align: center;
border-top: none;
display: inline-block;
}
.button + .button {
border-left: none;
}
</style>
<script>
var series = [];
var obj = {};
obj["name"] = "";
obj["source"] = "";
obj["width"] = "";
obj["height"] = "";
series.push(obj);
for (i = 0; i < series.length; i++) {
$('#tabs').append('<a class="button" onclick="change(id)" id="' + series[i].name + '" ">' + series[i].name + '</a>');
}
for (i = 0; i < series.length; i++) {
$("#tabs .button:last").after("<img class='pics' align='center' id='" + series[i].name + "' src='" + series[i].source + "' width='" + series[i].width + "' height='" + series[i].height + "'>");
}
$(".pics").hide(); $("#" + series[0].name).show();
function change(id) {
for (i = 0; i < series.length; i++) {
document.getElementById(series[i].name).style.backgroundColor = "#b36e14"; //saddle
} document.getElementById(id).style.backgroundColor = "#89540F"; //darker
$(".pics").hide(); $("#" + id).show();
}
</script>


