Widget:CampaignCards: Difference between revisions
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("onmousemove", "move(event)"); | |||
$(this).attr("title", ""); | $(this).attr("title", ""); | ||
}); | }); | ||
var tooltipSpan = $(".campaignbox-characters a:hover:after"); | |||
function move(e){ | |||
for (var i = 0; i < tooltipSpan.length; i++) { | |||
tooltipSpan[i].style.top = (e.clientY + 10) + 'px'; | |||
tooltipSpan[i].style.left = (e.clientX + 10) + 'px'; | |||
} | |||
} | |||
function openCard(card){ | function openCard(card){ | ||
| Line 60: | Line 70: | ||
display: block; | display: block; | ||
text-align: justify; | text-align: justify; | ||
position: fixed; | |||
} | } | ||
.character-portrait { | .character-portrait { | ||
Revision as of 04:01, 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('
'+ series1[i].season +'
' + series1[i].name + '
');
}
$(".campaignbox-characters a").each(function() { $(this).attr("data-title", $(this).attr("title")); $(this).attr("onmousemove", "move(event)"); $(this).attr("title", ""); });
var tooltipSpan = $(".campaignbox-characters a:hover:after");
function move(e){ for (var i = 0; i < tooltipSpan.length; i++) {
tooltipSpan[i].style.top = (e.clientY + 10) + 'px'; tooltipSpan[i].style.left = (e.clientX + 10) + 'px'; }
}
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 {
border: 1px solid #fc0; padding: 3px 6px; background: #fffea1; content: "TOOLTIP"; display: block; text-align: justify; position: fixed;
} .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>


