in script, function in question @ end of
$(jquery).ready(function(){...}); for reason firing before dom loaded. i'll post whole script below. interested in happens @ lines 246-248.
this buggy part:
alert(listobj.listoffset); listobj.alllists.offset({ left: listobj.listoffset }); listobj.alllists[listindex].focus(); a little more detail
this particular part of script trying put focus on today. there layout object should enable process. needs run after dom loads, can calculate layout offset variables. when loads early, offset ends being 15000px instead of 400ish.
if can offer things for, might me figure out, if can't pinpoint solution. understand lot of code. enterprise app lot of hands working on it.
my script section of document
// bind listeners time input fields $('.timeblock').on("blur", validatehrs); $('.timeblock').keyup(function () { var listobj = new layoutobj(); listobj.tabnav(); }); // bind listeners prev/next buttons $('.previous, .next').on("click", function () { var str = $(this).attr('class'); var obj = new layoutobj(); obj.navdates(str); }); // calculate totals stored inputs totalhrs(); // highlight today's date var today = new date(); var thismonth = today.getmonth(); var thisdate = today.getdate(); var datestr = ''; var splitdates = new array(); var fulldates = new array(); var listindex; var listobj; fulldates = $('.datenum'); fulldates.each(function (index) { splitdates[index] = $(this).text().split('/'); }); (var = 0; < splitdates.length; i++) { if (thismonth === (parseint(splitdates[i][0], 10) - 1) && thisdate === parseint(splitdates[i][1], 10)) { thismonth += 1; thismonth += ''; thisdate += ''; if (thismonth.length < 2) { datestr = "0" + thismonth + "/"; } else { datestr = thismonth + "/"; } if (thisdate.length < 2) { datestr += "0" + thisdate; } else { datestr += thisdate; } fulldates[i].parentnode.setattribute('class', 'date today'); listindex = i; } //the following code shift job lists reveal today's date ///////, if not in view on load. } var listobj = new layoutobj(); listobj.listoffset = listobj.cellwidth * (listindex + 1); //alert(listobj.listoffset); listobj.alllists.offset({ left: listobj.listoffset }); listobj.alllists[listindex].focus(); }); layoutobj
you should using:
$(document).ready(function () { ... });
when fires before dom loaded, in script have put entirety of code document ready block. of code affect sizing?
are sure code isn't broken? example, pull block out , bind click event.
Comments
Post a Comment