이 기사에서는 JS Custom Sorizontal Scrolling Font 플러그인에 대해 설명합니다. 다음과 같이 참조에 대해 공유하십시오.
<script type = "text/javaScript"> $ (function () {var setting = {컨텐츠 : "@@@@@@ flaating ####", 오버 스탑 : true, width : "100px", targetId : "huangbiao", // 디스플레이 후 콜백 함수는 onftershow : function (obj) {obj.setting.width = "20px" 경고 (DDDD). /* 원리 설명 : 1. 상위 부모 div는 숨겨진 스크롤 막대 2입니다. 두 번째 레벨 DIV의 너비 (상단 부모 div의 자식 div)는 8000% 3입니다. Div1과 Div2 (가장 왼쪽)와 Div2 (두 번째 왼쪽)가 있으며 노드 내용은 정확히 동일합니다. 상단 Div 스크롤 막대의 스크롤 막대는 상단 DIV의 스크롤 막대의 거리보다 크거나 같으며, 상단 div의 스크롤 막대의 거리가 0 */ function fontmove (usersettingobj) {var that = this; // 타임 스탬프를 ID 값으로 사용합니다 var timestamp = new Date (). gettime (); this.setting = {// 텍스트 콘텐츠 스크롤 컨텐츠 내용 : "플로팅 텍스트", // 스크롤 막대의 너비는 너비가 표시됩니다. ""인 경우 저장된 경우, 기본값은 차체 태그의 끝에 배치됩니다. targetId : "", OnAfterShow : function () {}}; // 사용자의 구성 파일을 가져옵니다. // 구성 파일의 매개 변수를 확인하십시오. checkparam = function () {} // Extension Plugin this.callback = function (myfun) {if (myfun == "function") {// 콜백을 의미하므로 부모 myfun.call (that)을 사용해야합니다. }} this. this.remove = function () {$ ( "#"+that.setting.objid) .remove (); } this.init = function () {// 구성 파일을 가져 오는 모든 메소드는 var domstr = '<div id = "'+ that.setting.objid+ '"style = "오버 플로우 : 숨겨진; width :'+ thats.width+ '">'+ '<div> <+'<div id = ''+ that. '_div1" style="float:left;">'+that.setting.content+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'+ '</div>'; // 컨텐츠의 위치가 지정되어 있는지 ( ""== that.setting.targetId) {$ ( "body"). Append (domstr); } else {$ ( "#"+that.setting.targetid) .html (domstr); } // 컨텐츠 컨테이너 div var thatdiv = document.getElementById (that.setting.objid); // 왼쪽의 첫 번째 자식 div var sondiv1 = document.getElementById (that.setting.objid + '_div1'); // 왼쪽의 두 번째 자식 div var sondiv2 = document.getElementById (that.setting.objid + '_div2'); this.marquee = function () {// 타이머를 사용하여 // console.log ( "thatdiv.scrollleft :" + thatdiv.scrollleft); // //sondiv1.offsetWidth 값은 // console.log ( "sondiv1.offsetwidth :" + sondiv1.forfsetwidth); scrollbars // console.log ( "sondiv1.scrollleft :" + sondiv1.scrollleft); // //sondiv2.offsetwidth 값은 고정 // console.log ( "sondiv2.offsetwidth : /// // 값이 0이 없기 때문에 // console.log ( "sondiv2.scrollleft :" + sondiv2.scrollleft); // 상단 div 스크롤 바의 거리는 첫 번째 자식 div의 수평 거리보다 크지는데, 즉, 컨텐츠의 실제 거리보다 큰지 (thatdiv.scrollleft -sondiv1.offsetwidth> = 0) {// 스크롤 막대의 길이는 다시 0으로 지워집니다. Thatdiv.scrollleft -sondiv1.offsetwidth; } else {thatdiv.scrollleft ++; }} var myvar = setInterval (that.marquee, that.setting.speed); // 마우스가 중단되면 (that.setting.overstop) {thatdiv.onMouseOver = function () {맑은 interval (myvar);} thatdiv.onMouseOut = function () {myvar = setInterVal (marquee, 30);}} if (type that. that.setting.onaftershow.call (That, That); }} // 초기화를 완료 this.init (); // 메소드 자체를 반환하여이를 구성하는 모든 매개 변수를 얻을 수 있도록하십시오. } </스크립트>JavaScript 관련 컨텐츠에 대한 자세한 내용은이 사이트의 주제를 확인하십시오. "JavaScript 스위칭 효과 및 기술 요약", "JavaScript 검색 알고리즘 기술 요약", "JavaScript 애니메이션 효과 및 기술 요약", "Javascript 오류 및 디버깅 기술의 요약" "JavaScript 기술의 요약" "" "요약" "", Malgority Sknickes의 요약 "". JavaScript Traversal 알고리즘 및 기술 "및"JavaScript 수학 연산 사용 요약 "
이 기사가 모든 사람의 JavaScript 프로그래밍에 도움이되기를 바랍니다.