117.png

Difference between revisions of "MediaWiki:Common.js"

From ITSTEP
Jump to: navigation, search
Line 47: Line 47:
  
  
window.onload = function() {  
+
jQuery( document ).ready(function() {
 +
jQuery('#scrollup img').mouseover( function(){
 +
jQuery( this ).animate({opacity: 0.65},100);
 +
}).mouseout( function(){
 +
jQuery( this ).animate({opacity: 1},100);
 +
}).click( function(){
 +
window.scroll(0 ,0);
 +
return false;
 +
});
  
var scrollUp = document.getElementById('scrollup');
+
jQuery(window).scroll(function(){
 
+
if ( jQuery(document).scrollTop() > 0 ) {
scrollUp.onmouseover = function() {
+
jQuery('#scrollup').fadeIn('fast');
scrollUp.style.opacity=0.3;
 
scrollUp.style.filter  = 'alpha(opacity=30)';
 
};
 
 
 
scrollUp.onmouseout = function() {  
 
scrollUp.style.opacity = 0.5;
 
scrollUp.style.filter  = 'alpha(opacity=50)';
 
};
 
 
 
scrollUp.onclick = function() {
 
window.scrollTo(0,0);
 
};
 
 
 
 
 
 
 
window.onscroll = function () {
 
if ( window.pageYOffset > 0 ) {
 
scrollUp.style.display = 'block';
 
 
} else {
 
} else {
scrollUp.style.display = 'none';
+
jQuery('#scrollup').fadeOut('fast');
 
}
 
}
};
+
});
};
+
});

Revision as of 08:56, 4 April 2017

/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */

document.onclick=function(ev){
var obj=ev?ev.target:event.srcElement;

while(obj.parentNode){
if(obj.className=="spoiler"){break;}
else{obj=obj.parentNode;}};

if(obj.className=="spoiler"){
clickSpoiler(obj);
return false;};

closet();
 };
 
function clickSpoiler(el){
var s=el.getElementsByTagName("dd")[0].style.display;
closet();
if(s=="none"||s==""){
el.getElementsByTagName("dd")[0].style.display="block";};
 };
 
function closet(){
var m, k;
m=document.getElementsByTagName("dl");
k=m.length;
while(k--){
if(m[k].className=="spoiler"){
m[k].getElementsByTagName("dd")[0].style.display="none";}};
 };








jQuery(document).ready(function(){
	jQuery('.spoiler-head').click(function(){
		$(this).parents('.spoiler-wrap').toggleClass("active").find('.spoiler-body').slideToggle();
	})
})




jQuery( document ).ready(function() {
	jQuery('#scrollup img').mouseover( function(){
		jQuery( this ).animate({opacity: 0.65},100);
	}).mouseout( function(){
		jQuery( this ).animate({opacity: 1},100);
	}).click( function(){
		window.scroll(0 ,0); 
		return false;
	});

	jQuery(window).scroll(function(){
		if ( jQuery(document).scrollTop() > 0 ) {
			jQuery('#scrollup').fadeIn('fast');
		} else {
			jQuery('#scrollup').fadeOut('fast');
		}
	});
});