nachomendi nachomendi - 1 month ago 11
Java Question

Kalendae in javascript not showing correctly in netbeans

I'm using Netbeans IDE 8.0.2 and kalendae by chiperSoft: https://github.com/ChiperSoft/Kalendae

for some reason when i include it in any of the pages it doesn't display correctly:



This is the code I used for creating the calendar:

<div id="wrap">
<script type="text/javascript" charset="utf-8">

var wrap = document.getElementById('wrap');
var cal = new Kalendae(document.body,{
blackout: function (date) {return [1,0,0,0,0,0,1][Kalendae.moment(date).day()];},
months: 1,
mode: 'single',
selected: new Date('<%=FechA%>')
});

cal.subscribe('change', function () {


window.location="Asistencias.jsp?idca=<%=ca.getidCA()%>&fecha="+this.getSelected(); // console.log( this.getSelected());});
</script>
</div>


As you can see i'm using JSP (i know it's not a good practice, but i was asked to do this with jsp, so i have no option)

When I tried the same code on a blank html page outside of my IDE (replacing the variables with values), the calendar displayed just right, so i guess it's a problem of my project. I included all the js code and css too:

<link rel="stylesheet" href="../Css/Kalendae.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="../Css/metal.css" type="text/css" charset="utf-8">
<script src="../Js/Kalendae.js" type="text/javascript"></script>


I even tried disabling my css, thinking that it was that what was causing problems, but the calendar continued displaying wrong.

Thanks in advance.

Answer

Nevermind, it was a really dumb problem. The calendar's css wasn't right. It's width was too low.

If anybody comes up with this issue just zoom to check if that is the problem. If that is the case just modifiy the width of your container to something bigger

/** Base container **/
#wrap{
width:400px; //originally this was 300px, which wasn't enough
margin-top: 160px;
margin-left: 40px;

}

Comments