Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var newsVisualVertical = 4;
- var intervalloVert = 4000;
- var numNewsVert;
- var larghezzaDivVert = 150;
- var altezzaDivVert = 118;
- var margineDivVert = 5;
- var newsVisualOrizzontal = 25;
- var intervalloOriz = 7000;
- var larghezzaDivOriz = 298;
- var altezzaDivOriz = 96;
- var margineDivOriz = 1;
- $(document).ready(function() {
- numNewsVert = $("#jqnewsVert").children().length;
- numNewsOrizzontal = $("#jqnewsOriz").children().length;
- if (numNewsVert > 0) {
- jqnewsVertical();
- }
- if (numNewsOrizzontal > 0) {
- jqnewsOrizzontal();
- }
- });
- function jqnewsVertical() {
- if (newsVisualVertical > numNewsVert) {
- newsVisualVertical = numNewsVert;
- }
- for (var i = newsVisualVertical; i < numNewsVert; i++) {
- $($("#jqnewsVert").children()[i]).css("opacity", "0");
- }
- var gestInter = setInterval(jqNewsRotateVertical, intervalloVert);
- $("#jqnewsVert").mouseover(function() { clearInterval(gestInter) });
- $("#jqnewsVert").mouseout(function() { gestInter = setInterval(jqNewsRotateVertical, intervalloVert); });
- }
- function jqNewsRotateVertical() {
- $($("#jqnewsVert").children()[0]).animate({ opacity: 0 }, 1000, "linear", function() {
- $($("#jqnewsVert").children()[0]).animate({ marginTop: -altezzaDivVert }, 1000, "linear", function() {
- $($("#jqnewsVert").children()[0]).css("margin", margineDivVert);
- $("#jqnewsVert").append($($("#jqnewsVert").children()[0]));
- $($("#jqnewsVert").children()[newsVisualVertical - 1]).animate({ opacity: 1 }, 1000);
- });
- });
- }
- function jqnewsOrizzontal() {
- // Controllo di overflow
- if (newsVisualOrizzontal > numNewsOrizzontal) {
- newsVisualOrizzontal = numNewsOrizzontal;
- }
- // Hide delle news superflue all'inizializzazione
- for (var i = newsVisualOrizzontal; i < numNewsOrizzontal; i++) {
- $($("#jqnewsOriz").children()[i]).css("opacity", "0");
- }
- var gestInter = setInterval(jqNewsRotateOrizzontal, intervalloOriz);
- $("#jqnewsOriz").mouseover(function() { clearInterval(gestInter) });
- $("#jqnewsOriz").mouseout(function() { gestInter = setInterval(jqNewsRotateOrizzontal, intervalloOriz); });
- }
- function jqNewsRotateOrizzontal() {
- // Hide della prima news
- $($("#jqnewsOriz").children()[0]).animate({ opacity: 0 }, 1000, "linear", function() {
- $($("#jqnewsOriz").children()[0]).animate({ marginLeft: -larghezzaDivOriz }, 1000, "linear", function() {
- $($("#jqnewsOriz").children()[0]).css("margin", margineDivOriz);
- $("#jqnewsOriz").append($($("#jqnewsOriz").children()[0]));
- $($("#jqnewsOriz").children()[(newsVisualOrizzontal - 1)]).animate({ opacity: 1 }, 1000);
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement