JAVASCRIPT
-
스크롤시작 종료JAVASCRIPT 2020. 6. 11. 17:17
$("#page-content-scroll").scroll(function() { //스크롤시작 clearTimeout($.data(this, 'scrollTimer')); $.data(this, 'scrollTimer', setTimeout(function() { $("#marketRegister").css("display", "block"); $("#scrollTopBtn").css("display", "block"); }, 200)); //스크롤종료시 2초후 실행 });
-
자바스크립트 많이 쓰일 함수들JAVASCRIPT 2020. 6. 11. 17:13
parseInt($("#making").val(), 10); //10진수 숫자로 변환 $(':radio[name="butterfly"]:checked').val(); //라디오버튼 체크된 값 $("select[name='viewSuboption[]']").each(function(){}); //해당셀렉터인풋배열 반복 $(this).find("option").each(function(){}); //해당셀렉터 옵션들 반복 Math.round((optWidth + 40) /130) + 1; // 반올림 Math.ceil((optWidth *2) /150) ; //올림 Math.floor((optWidth *2) /150) ; //내림 $("selector").each(function(){}); // 셀렉터만큼..
-
인풋 가격 콤마찍기JAVASCRIPT 2020. 6. 11. 17:12
$(".numberFormat").each(function(){ $(this).keyup(function(){ var val = $(this).val(); var res = numberWithCommas(numberWithUncommas(val)); $(this).val(res); }); }); function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } function numberWithUncommas(x) { return x.toString().replace(/[^\d]+/g, ''); }
-
-
원하는 영역만 프린트하기JAVASCRIPT 2020. 5. 28. 10:05
function chartsPrint(chartDiv) { var chartHtml = $("#"+chartDiv).html(); win = window.open(); self.focus(); win.document.open(); var textJquery = '\\'; win.document.write(''+textJquery+'daonbid'); win.document.write(chartHtml); win.document.write(''); if(chartDiv != "ccc") { var pageHtml = win.document.getElementsByClassName("pagination")[0]; while ( pageHtml.hasChildNodes() ) { pageHtml.removeC..
-
javascript 날짜 시간 계산JAVASCRIPT 2020. 5. 28. 10:03
var loadDt = new Date(); //현재 날짜 및 시간 //현재시간 기준 계산 alert(new Date(Date.parse(loadDt) - 30 * 1000 * 60 * 60 * 24)); //30일전 alert(new Date(Date.parse(loadDt) - 15 * 1000 * 60 * 60 * 24)); //보름전 alert(new Date(Date.parse(loadDt) - 7 * 1000 * 60 * 60 * 24)); //일주일전 alert(new Date(Date.parse(loadDt) - 1 * 1000 * 60 * 60 * 24)); //하루전 alert(new Date(Date.parse(loadDt) + 1 * 1000 * 60 * 60 * 24)); //하루..