»
Tiếng AnhTiếng PhápTiếng Việt

In - Teleprompter - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Chữ » Hoạt hóa » Teleprompter
URL: https://www.javascriptbank.com/teleprompter.html

Teleprompter © JavaScriptBank.comMột đoạn mã JavaScript khác để làm cho chữ cuộn tự động. Chức năng của hiệu ứng khá đơn giản. Một đối tượng <div> chứa đoạn text cần cuộn và người dùng nhấn chuột vào đoạn text để cuộn nó, tốc độ cuộn có thể thay đổi bằng các phím [ và ].

Phiên bản đầy đủ: jsB@nk » Chữ » Hoạt hóa » Teleprompter
URL: https://www.javascriptbank.com/teleprompter.html



CSS
<style>body {/* font-family: Helvetica,Arial,sans-serif; font-size: 2.4em; line-height: 1.4; background: #000; color: #fff; overflow: hidden;*/}#speech { position: absolute; text-align: left; left: 0;}p { margin: .5em;}.slide { text-align: center; margin: 0;}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script>/*Created by: Jeremy Keith Web Site: http://adactio.com/*//*global document, window, event */var scroll = function(element) { var scrolling = null; var inc = 1; var wait = 50; var getYpos = function() {  var ypos = element.offsetTop;  var thisNode = element;  while (thisNode.offsetParent &&  (thisNode.offsetParent != document.body)) {   thisNode = thisNode.offsetParent;  ypos += thisNode.offsetTop; } return ypos; }; var doScroll = function() {  var y = parseInt(getYpos(),10);  y=y-inc;  y=y+"px";  element.style.top = y;  scrolling = window.setTimeout(doScroll,wait); }; var toggleScrolling = function() {  if (scrolling) {   window.clearTimeout(scrolling);   scrolling = null;  } else {   doScroll();  } }; element.onclick = toggleScrolling;// 'keys' code adapted S5 (http://www.meyerweb.com/eric/tools/s5/)//which was in turn adapted from MozPoint (http://mozpoint.mozdev.org/) var keys = function(key) {  if (!key) {   key = event;   key.which = key.keyCode;  }switch (key.which) { case 221:// ]  if (scrolling) {   inc++;  } break; case 219:// [   if (scrolling && inc>1) {   inc--;  } break; case 10:// return case 13:// enter  toggleScrolling(); break;}  return false; }; document.onkeyup = keys;};var init = function() { if (document.getElementById && document.getElementById("speech")) {  scroll(document.getElementById("speech")); }};window.onload = init;</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<div id="speech"><p><strong>From Basic Forms to Shopping Carts</strong><br><br>An electronic shopping cart is a critical aspect of an e-commerce business. The shopping cart is the software (or series of scripts) that allows users to select products from your Web site, save them and check out when they are done shopping. In the early stages of electronic shopping, the shopping cart was usually a basic HTML form from which a customer selected the products he  wanted to purchase. Long before using a credit card over the Internet was widely accepted, it was common to find that you would need to print the form and mail it along with a money order or credit card information to the company. Over time, as e-commerce grew and online stores began to offer hundreds, if not hundreds of thousands of products, obviously a better method for storing a customer's purchases and placing an order was needed.</p><p>The shopping cart acts as the user-interface for the customer to shop. It allows users to place items in a "shopping basket". The cart remembers these items for a predetermined length of time, usually 15 to 30 days unless the shopper removes the items from the cart. Today's shopping carts are really designed for the ease-of-use of the shopper. Extra features such as different color or size options, quantity of order, and matching item links can be integrated into the shopping cart. Once a shopper enters her shipping address, taxes and shipping costs can also be tallied from within the shopping cart. For the merchant, the shopping cart also provides important information, which is often transparent to the shopper, including a cart number to track the order, and even a cookie to provide you with some limited tracking details about your customer.</p></div><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->