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 7: Line 7:
<img id="pic" align="middle">
<img id="pic" align="middle">
<style>
<style>
  .button {
    .button {
    color: white;
        color: white;
    border: 1px solid #64320d;
        border: 1px solid #64320d;
    background-color: #b36e14;
        background-color: #b36e14;
    font-family: "Arial";
        font-family: "Arial";
    letter-spacing: .5px;
        letter-spacing: .5px;
    padding: 5px;
        padding: 5px;
    text-align: center;
        text-align: center;
    border-top: none;
        border-top: none;
    display: inline-block;
        display: inline-block;
  }
    }
 
.button + .button {
border-left: none;
}


    .button+.button {
        border-left: none;
    }
</style>
</style>


<script>
<script>
    var series = [];
  var series = [];


  <!--{foreach from=$tab key=name item=info}-->
    <!--{foreach from=$tab key=name item=info}-->
  var obj = {};
    var obj = {};
  obj["name"] = "<!--{$info.name|escape:'javascript'}-->";
    obj["name"] = "<!--{$info.name|escape:'javascript'}-->";
  obj["source"] = "<!--{$info.source|escape:'javascript'}-->";
    obj["source"] = "<!--{$info.source|escape:'javascript'}-->";
  obj["width"] = "<!--{$info.width|escape:'javascript'}-->";
    obj["width"] = "<!--{$info.width|escape:'javascript'}-->";
  obj["height"] = "<!--{$info.height|escape:'javascript'}-->";
    obj["height"] = "<!--{$info.height|escape:'javascript'}-->";
  series.push(obj);
    series.push(obj);
  <!--{/foreach}-->
    <!--{/foreach}-->






  for (i = 0; i < series.length; i++) {  
    for (i = 0; i < series.length; i++) {
var name = series[i].name.replace(/ /g,"_");
        var name = series[i].name.replace(/ /g, "_");
    $('#tabs').append('<a class="button" onclick="change(id)" id="' + name + '" ">' + series[i].name + '</a>');
        $('#tabs').append('<a class="button" onclick="change(id)" id="' + name + '" ">' + series[i].name + '</a>');
  }
    }


  for (i = 0; i < series.length; i++) {  
    for (i = 0; i < series.length; i++) {
var name = series[i].name.replace(/ /g,"_");
        var name = series[i].name.replace(/ /g, "_");
$("#tabs .button:last").after("<img class='pics' align='center' id='" + name + "-pic' src='" + series[i].source + "' width='" + series[i].width + "' height='" + series[i].height + "'>");
        $("#tabs .button:last").after("<img class='pics' align='center' id='" + name + "-pic' src='" + series[i].source + "' width='" + series[i].width + "' height='" + series[i].height + "'>");
  }
    }
$(".pics").hide();
    $(".pics").hide();
$("#" + series[0].name.replace(/ /g,"_") + "-pic").show();
    $("#" + series[0].name.replace(/ /g, "_") + "-pic").show();
document.getElementById(series[0].name.replace(/ /g,"_")).style.backgroundColor = "#89540F";
    document.getElementById(series[0].name.replace(/ /g, "_")).style.backgroundColor = "#89540F";
    $("#tabs .button").after("<br><br>");


  function change(id) {
    function change(id) {
    for (i = 0; i < series.length; i++) {
        for (i = 0; i < series.length; i++) {
      document.getElementById(series[i].name.replace(/ /g,"_")).style.backgroundColor = "#b36e14"; //saddle
            document.getElementById(series[i].name.replace(/ /g, "_")).style.backgroundColor = "#b36e14"; //saddle


    }
        }
    document.getElementById(id).style.backgroundColor = "#89540F"; //darker
        document.getElementById(id).style.backgroundColor = "#89540F"; //darker
   
$(".pics").hide();
$("#" + id.replace(/ /g,"_") + "-pic").show();


  }
        $(".pics").hide();
        $("#" + id.replace(/ /g, "_") + "-pic").show();


    }
</script>
</script>

Revision as of 04:30, 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++) {
       var name = series[i].name.replace(/ /g, "_");
       $('#tabs').append('<a class="button" onclick="change(id)" id="' + name + '" ">' + series[i].name + '</a>');
   }
   for (i = 0; i < series.length; i++) {
       var name = series[i].name.replace(/ /g, "_");
       $("#tabs .button:last").after("<img class='pics' align='center' id='" + name + "-pic' src='" + series[i].source + "' width='" + series[i].width + "' height='" + series[i].height + "'>");
   }
   $(".pics").hide();
   $("#" + series[0].name.replace(/ /g, "_") + "-pic").show();
   document.getElementById(series[0].name.replace(/ /g, "_")).style.backgroundColor = "#89540F";
   $("#tabs .button").after("

");
   function change(id) {
       for (i = 0; i < series.length; i++) {
           document.getElementById(series[i].name.replace(/ /g, "_")).style.backgroundColor = "#b36e14"; //saddle
       }
       document.getElementById(id).style.backgroundColor = "#89540F"; //darker
       $(".pics").hide();
       $("#" + id.replace(/ /g, "_") + "-pic").show();
   }

</script>