script type text javascript document ready function -------------- rem

 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
<script type="text/javascript">
$(document).ready(function(){
// --------------
$('a.remote').remote('#defolt', function() {
if (window.console && window.console.info) {
console.info('content loaded');
}
});
$.ajaxHistory.initialize();
// --------------
$('.box-an').click(
function() {
$('.box').animate({marginLeft: "100"}, 100);
setTimeout(function(){
$('.box').load('page2.html div');
}, 100); return false;
});
$('.aj').click(
function() {
idElem = document.getElementById("newnew");
idElem.parentNode.removeChild(idElem);
$('#defolt').load('page2.html');
$('#defolt').animate({ opacity: "0" }, 1);
$('#defolt').animate({ opacity: "1" }, 400); return false;
});
// --------------
$("#loading").ajaxStart(function(){
setTimeout(function(){
$(this).show();
}, 500);
});
$("#loading").ajaxStop(function(){
$(this).fadeOut(400);
});
jQuery.fn.center2 = function()
{
var w = $(window);
this.css("position","absolute");
this.css("top",(w.height()-this.height())/2+w.scrollTop() + "px");
this.css("left",(w.width()-this.width())/2+w.scrollLeft() + "px");
return this;
}
jQuery.fn.center = function() {
this.css("top", "50%");
this.css("left", "50%");
this.css("position", "absolute");
this.css("width", "200px");
this.css("marginLeft", "-100px");
this.css("marginTop", "-10px");
this.css("height", "20px");
this.css("background", "red");
return this;
};
$('#loading').center();
$('<div id="bold">Полужирный текст</div>').appendTo($("#example"));
});
</script>