…
…
Nel tutorial di oggi vi mostreremo come animare uno sfondo scrivendo un piccolo script javascript/jQuery che calcola dinamicamente la posizione dell’immagine.
(function($) { // #your-image is div with the image background var yourImage = $("#your-image"); yourImage.css('backgroundPosition', '0px' + ' ' + '0px'); window.setInterval(function() { yourImage.css("backgroundPosition", x + 'px' + ' ' + y + 'px'); y--; }, 80); })(jQuery); …
…
…
…
…
…
In questo semplice tutorial javascript vi mostreremo come creare un pulsante che al click copia negli appunti il testo selezionato in una textarea.
<script language="javascript"> function CopyText(el){ var selectedText = ""; if(window.getSelection){ selectedText = window.getSelection(); }else if (document.getSelection){ selectedText = document.getSelection(); }else if (document.selection){ selectedText = document.selection.createRange().text; } if(selectedText != ""){ selectedText = selectedText.toString(); el.focus(); el.value = selectedText; …
…