1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
| <!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page Title</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Page 2 Section 1</h1>
</div>
<div data-role="content">
<h2>Page 2 Section 1</h2>
<ul data-role="listview" data-inset="true">
<li data-role="list-divider">Menu de la Page 2</li>
<li><a href="#section22">Page 2 Section 2</a></li>
<li><a href="#section23">Page 2 Section 3</a></li>
<li><a href="#section24">Page 2 Section 4</a></li>
<li><a href="#section25">Page 2 Section 5</a></li>
</ul>
<div id="divID"></div>
</div>
<div data-role="footer">
<h1>Footer</h1>
</div>
</div>
<div data-role="page" id="section22" data-add-back-btn="true">
<div data-role="header">
<h1>Page 2 Section 2</h1>
</div>
<div data-role="content">
<h2>Page 2 Section 2</h2>
</div>
<div data-role="footer">
<h1>Footer</h1>
</div>
</div>
<div data-role="page" id="section23" data-add-back-btn="true">
<div data-role="header">
<h1>Page 2 Section 3</h1>
</div>
<div data-role="content">
<h2>Page 2 Section 3</h2>
</div>
<div data-role="footer">
<h1>Footer</h1>
</div>
</div>
<div data-role="page" id="section24" data-add-back-btn="true">
<div data-role="header">
<h1>Page 2 Section 4</h1>
</div>
<div data-role="content">
<h2>Page 2 Section 4</h2>
</div>
<div data-role="footer">
<h1>Footer</h1>
</div>
</div>
<div data-role="page" id="section25" data-add-back-btn="true">
<div data-role="header">
<h1>Page 2 Section 5</h1>
</div>
<div data-role="content">
<h2>Page 2 Section 5</h2>
</div>
<div data-role="footer">
<h1>Footer</h1>
</div>
</div>
<script>
(function($){
$.dvjhGoUp = function(options){
var opts = $.extend(true, {}, $.dvjhGoUp.defaults, options);
$("<img/>", {
id:opts.imgId,
src:opts.imgSrc,
css:{
display:"none",
position:"fixed",
bottom:opts.bottom,
right:opts.right,
width:opts.imgWidth,
height:opts.imgHeight,
border:opts.imgBorder,
cursor:opts.imgCursor
},
alt:opts.imgAlt,
title:opts.imgTitle,
click:function(){
$("html, body").animate({scrollTop: "0px"}, opts.scrollDelay);
return false;
}
}).appendTo("body");
$(window).bind("scroll", function() {
var obj = $("#"+opts.imgId);
if ($(this).scrollTop() > opts.scrollImg){
obj.fadeIn(opts.imgFadeInDelay);
} else {
obj.fadeOut(opts.imgFadeOutDelay);
}
});
};
$.dvjhGoUp.defaults = {
bottom: "6px", // position fixed bottomRight
right: "6px", // position fixed bottomRight
imgId: "dvjhGoUp",
imgSrc: "http://danielhagnoul.developpez.com/images/dvjhGoUp.png", // exemple : "images/dvjhGoUp.png"
imgAlt: "Monter. Go up.",
imgTitle: "Monter. Go up.",
imgWidth: "50px",
imgHeight: "48px",
imgBorder: "none",
imgCursor: "pointer",
imgFadeInDelay: 800, // 0.8s
imgFadeOutDelay: 800, // 0.8s
scrollImg: 300, // distance de scroll, en px, avant l'apparition ou la disparition de l'image
scrollDelay: 2000 // durée de l'animation 2s
};
})(jQuery);
$(window).load(function(){
// le code fonctionne, il modifie le texte de
// la Page 2 Section 4
$("#section24").css({
"font-family": "cursive !important",
"font-size": "0.95em !important"
});
/***************************
* Speed Table By SpaceFrog *
**************************/
function buildTable(destObj, nbrLines, nbrCells){
var baliseTable = document.createElement('table'),
baliseTbody = document.createElement('tbody');
baliseTable.id = "foo";
for(var i = 0; i < nbrLines; i++){
new addLine(baliseTbody, nbrLines, nbrCells, i);
}
baliseTable.appendChild(baliseTbody);
destObj.appendChild(baliseTable);
document.close();
}
function addLine(destBody, nbrLines, nbrCells, contenu){
var newLine = document.createElement('tr');
for(var l=0; l < nbrCells; l++){
new addCells(newLine, contenu + '_' + l);
}
destBody.appendChild(newLine);
}
function addCells(destLine, contenu){
var newCell = document.createElement('td');
newCell.style.border = "solid 1px gray";
newCell.appendChild(document.createTextNode('Cellule ' + contenu));
destLine.appendChild(newCell);
}
//-----------------------
/*
* On construit, très rapidement, une grande
* table de test d'ID "foo", en utilisant la
* fonction BuildTable de @SpaceFrog.
*
* (élément du DOM, nb de lignes, nb de colonnes)
*/
buildTable($("#divID")[0], 2000, 6);
// pour remonter voir mon Cahier d'exercices
$.dvjhGoUp();
// On va vers la fin de la table
$('html,body').animate({
'scrollTop': ($("body").innerHeight() + $("#divID").innerHeight()) + "px"
}, 10000);
});
</script>
</body>
</html> |
Partager