Este artigo descreve o plug -in de fontes de rolagem horizontal personalizada JS. Compartilhe -o para sua referência, como segue:
<script type = "text/javaScript"> $ (function () {var configuring = {content: "@@@@@@@ texto flutuante ####", exagero: true, largura: "100px", TargetId: "huangbiao", // a função de retorno após a exibição é noftershow: function (function). alerta (dddd "); /* Principle description: 1. The top parent div is the hidden scroll bar 2. The width of the second level DIV (the child div of the top parent div) is 8000% 3. There are two third-level child divs, div1 (the most left) and div2 (the second left) and the node content is exactly the same, both floating to left 4. Set a timer, and the scroll bar of the top div scroll bar scroll to the left 1px 5. Once the length da barra de rolagem DIV superior é maior ou igual à distância da barra de rolagem da divisão superior, deixe a distância da barra de rolagem da divisão superior ser 0 */ function fontmove (userttingObj) {var que = this; // use o carimbo de data e hora como o valor de identificação var timeStamp = new Date (). GetTime (); this.setting = { //Scrolling text content content: "Floating text", //The width of the scroll bar is displayed width: "200px", //Speed every 30 milliseconds: 30, //Whether the mouse suspension stops, true is true, false is non-stop, default is true overStop: true, //The ID value of the scroll bar is objId: timestamp, //The target position of the space is armazenado, se for "", o padrão será colocado no final do tag corporal TargetId: "", ONAFTERSHOW: function () {}}; // Obtenha o arquivo de configuração do usuário this.setting = $ .Extend (this.setting, userTingObj); // Verifique os parâmetros do arquivo de configuração this.checkParam = function () {} // plugin de extensão this.callback = function (myfun) {if (typeof myfun == "function") {// Isso significa retorno de retorno, para que você use pai myfun.call (thath); }} this.remove = function () {$ ("#"+that.setting.objid) .remove (); } this.init = function () {// Todos os métodos para obter o arquivo de configuração devem usar isso. style = "float: esquerda;"> '+ that.setting.Content+' </div> '+' </div> '+' </div> '+' </div> '+' </div> '+' </div> '' '</div>' '' '</div' '' </div> '' '' '' '' '+' <// '</div>'+ '</div>'+ '</div>'; // julga se a localização do conteúdo é especificada se ("" == that.setting.targetId) {$ ("corpo"). Append (domstr); } else {$ ("#"+that.setting.targetId) .html (domstr); } // contêiner de conteúdo div var thatDiv = document.getElementById (that.setting.objid); // o primeiro filho da div em Var Sondiv1 = Document.getElementById (that.setting.objid + '_div1'); // o segundo filho da div na esquerda var sondiv2 = document.getElementById (that.setting.objid + '_div2'); this.Marquee = function () {// Use Timer para alterar o valor // console.log ("thatDiv.ScrollLeft:" + thatdiv.scrollleft); // //sondiv1.offsetWidth o valor é fixo // console.log ("Sondiv1.Offsetwidth:" scrollbars // console.log ("Sondiv1.scrollLeft:" + sondiv1.scrollleft); // //sondiv2.offsetWidth O valor é fixo // console.log ("Sondiv2.OffsetWidth:" + sondiv2SetWidth); // // //, sempre é 0,BOFIDTHTH: " + Sondiv2. console.log ("Sondiv2.Scrollleft:" + Sondiv2.Scrollleft); // Se a distância da barra de rolagem de Div superior é maior que a distância horizontal do primeiro filho da Div, ou seja, seja maior que a distância real do conteúdo se (thatdiv.Scrollleft - Sondiv1.OffsetWidth> = 0) {// O comprimento da barra de rolagem é novamente que é o que é o equivalente a que é o que é o que é o que é o scroll, que é o que é o scroll, que é o que é o que é o scroll. thatDiv.Scrollleft - Sondiv1.OffSetWidth; } else {thatdiv.scrollleft ++; }} var myvar = setInterval (that.marquee, that.setting.speed); // o mouse é suspenso, seja o movimento de movimento se (that.setting.overstop) {thatdiv.onMouseOver = function () {clearInterval (myvar);} thatdiv.onMouseOut = function () {myvar = setInterval (marquee, 30);}}}} (tipo de typeftting.Set.Set.Set.Onfther) that.setting.onaftershow.call (isso, isso); }} // termine a inicialização this.init (); // Retorna o próprio método, para que todos os parâmetros que configurem isso possam ser obtidos retorne isso; } </script>For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of Javascript Algoritmos e Técnicas de Traversal "e" Resumo do Uso do Javascript Mathematic Operations "
Espero que este artigo seja útil para a programação JavaScript de todos.