Widget:CampaignCards: Difference between revisions

From Unforgotten Realms Wiki
Jump to navigationJump to search
imported>Pillowkeeper
No edit summary
imported>Pillowkeeper
No edit summary
Line 25: Line 25:
$(".campaignbox-characters a").each(function() {
$(".campaignbox-characters a").each(function() {
$(this).attr("data-title", $(this).attr("title"));
$(this).attr("data-title", $(this).attr("title"));
$(this).attr("position", "relative");
$(this).attr("title", "");
$(this).attr("title", "");
});
});

Revision as of 04:23, 30 August 2017

<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>

<script> var series1 = [];

var obj = {};

 obj["name"] = "";
 obj["image"] = "";
 obj["season"] = "";
 obj["content"] = ;
 obj["key"] = "";
 obj["height"] = "";
 series1.push(obj);

for(var i = 0; i < series1.length; i++){ console.log(series1[0].image);

$(".campaign-holder").append('

<img class="campaignbox-image" src="' + series1[i].image + '">

'+ series1[i].season +'

' + series1[i].name + '

' + series1[i].content + '

');

}

$(".campaignbox-characters a").each(function() { $(this).attr("data-title", $(this).attr("title")); $(this).attr("position", "relative"); $(this).attr("title", ""); });


function openCard(card){ var id = card.id var height = $(card).attr("data-height"); $("div#" + id + " div:not('.campaignbox-content')").fadeToggle('slow'); if(!$("div#" + id).hasClass("opened")){ $(".campaignbox:not('div#" + id + "')").hide(); $("div#" + id).animate({width:'650px', height: height}, function(){ $(".campaignbox:not('div#" + id + "')").fadeOut(); }); $("div#" + id + " div:not('.campaignbox-content')").hide('slow'); $("div#" + id + " .campaignbox-content").show('slow'); } else { $("div#" + id).animate({width:'200px', height: '184px'}, function(){ $("div#" + id + " .campaignbox-content").hide(); $(".campaignbox:not('div#" + id + "')").show(); $(".campaignbox:not('div#" + id + "')").fadeIn(); }); $("div#" + id + " div:not('.campaignbox-content')").show('slow'); } $("div#" + id).toggleClass("opened"); } </script>

<style>

.campaignbox-characters a:hover:after { background: #333;

   background: rgba(0,0,0,.8);
   border-radius: 5px;
   bottom: 26px;
   color: #fff;
   content: attr(data-title);
   left: 20%;
   padding: 5px 15px;
   position: absolute;
   z-index: 98;
   width: 220px;

} .character-portrait {

 object-fit: cover;
 width: 60px;
 height: 125px;
 margin: 3px;

} .campaignbox.opened {

 width: 650px;
 height: 184px;
 border: 3px solid white;
 border-radius: 10px;
 overflow: hidden;
 display: inline-block;
 background: rgb(33, 33, 33);
 margin: 8px;

} .campaignbox {

 width: 200px;
 height: 184px;
 border: 3px solid white;
 border-radius: 10px;
 overflow: hidden;
 display: inline-block;
 background: rgb(33, 33, 33);
 margin: 8px;

} .campaignbox-card {

   cursor: pointer;

} .campaignbox-image {

 width: 100%;
 opacity:0.85;
 margin-bottom: -5px;

} .campaignbox-text {

 padding: 0.01em 5px;
 color: white;
 text-align: center;

} .campaignbox-content {

 display: none;
 color:white;
 padding: 16px;
 }

</style>