117.png

Difference between revisions of "MediaWiki:Common.js"

From ITSTEP
Jump to: navigation, search
Line 64: Line 64:
  
  
function body_resize() {
+
var my = {
    var vp_width = $(window).width();
+
        window : $(window)
 
+
        };
    if (vp_width >= 240 && vp_width <= 320){
+
        alert ("Текущая ширина окна от 240 до 320 px")  
+
   
    }
+
    $(window).resize(function () {
 
+
    if (vp_width >= 320){
+
       
         alert ("Текущая ширина окна более 320 px")
+
        var width = my.window.width();
    }
+
}
+
       
 +
        if(my.window.width() < 640)
 +
        {
 +
            $(".right-content").css("float:none; clear:both");
 +
            $(".header-menu").css("float","left");
 +
 +
            if(width < 480)
 +
            {
 +
               
 +
 +
                if(width < 320)
 +
                {
 +
                 
 +
                }
 +
            }
 +
        }
 +
          
 +
        else
 +
        {
 +
            $(".right-content").css("float:left; clear:none");
 +
            $(".header-menu").css("float:none")
 +
        }
 +
 +
    });

Revision as of 15:19, 12 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();
	})
})




$(function() {
  $(window).scroll(function() {
  if($(this).scrollTop() != 0) {
  $('#topNubex').fadeIn();
  } else {
  $('#topNubex').fadeOut();
  }
  });
  $('#topNubex').click(function() {
  $('body,html').animate({scrollTop:0},700);
  });
  });





var my = {
        window : $(window)
        };
 
    
    $(window).resize(function () {
 
        
        var width = my.window.width();
 
        
        if(my.window.width() < 640)
        {
            $(".right-content").css("float:none; clear:both");
            $(".header-menu").css("float","left");
 
            if(width < 480)
            {
                
 
                if(width < 320)
                {
                   
                }
            }
        }
        
        else
        {
            $(".right-content").css("float:left; clear:none");
            $(".header-menu").css("float:none")
        }
 
    });