Difference between revisions of "Template:SYSU-Software/statics/js/index.js"

 
(5 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
$(document).ready(function () {
 
$(document).ready(function () {
    
+
   loadPages();
 +
  let dstPage = 0;
 +
  urlSplit = window.location.href.split('?');
 +
  if (urlSplit.length > 1) {
 +
    dstPage = 0 + pageList.findIndex((value, index, arr) => {
 +
      return value === urlSplit[1];
 +
    });
 +
  }
 +
  // console.log(dstPage);
  
 
   fkpage = $('.myfkpage').FKPageTransitions({
 
   fkpage = $('.myfkpage').FKPageTransitions({
 +
    preventDefaultSwipeY: true,
 +
    startSlide: dstPage,
 
     mode: 35,
 
     mode: 35,
 
     mouseWheel: false
 
     mouseWheel: false
 
   });
 
   });
   fkpage.goToNextSlide();
+
   let pageHeight = $(window).height();
   initTopBar("Home");
+
   let pageWidth = document.documentElement.clientWidth || document.body.clientWidth;
 
   (function () {
 
   (function () {
    let pageHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
 
 
     $('.myfkpage').css('height', pageHeight + 'px');
 
     $('.myfkpage').css('height', pageHeight + 'px');
     console.log(pageHeight)
+
     // console.log(pageHeight);
 
   })();
 
   })();
});
 
  
$('.myfkpage').children('li').each(function (index, ele) {
+
 
   $(this).addClass('test');
+
  // console.log(pageHeight);
 +
  // console.log(pageWidth);
 +
  $('#home-video').css('width', pageWidth + 'px');
 +
  $('#home-video').css('height', pageHeight + 'px');
 +
   // $('#home-video')[0].play();
 +
 
 
});
 
});
 +
 +
  
 
$('.dropdown').dropdown({
 
$('.dropdown').dropdown({
Line 28: Line 43:
 
   $('.ui.dropdown.link.item').not($(this)).dropdown('hide');
 
   $('.ui.dropdown.link.item').not($(this)).dropdown('hide');
 
   $(this).dropdown('show');
 
   $(this).dropdown('show');
 
 
});
 
});
$('.ui.dropdown.link.item').on('click', function() {
 
  // 当标题栏的标题被点击时,默认当作点击dropdown第一篇文章
 
  $b = $(this).get(0).children[1].children[0];
 
  $b.click();
 
})
 
;
 
  
$('#home').on('mouseenter', function() {
+
$('#home').on('mouseenter', function () {
   console.log('hei');
+
   // console.log('hei');
 
   $('.ui.dropdown.link.item').dropdown('hide');
 
   $('.ui.dropdown.link.item').dropdown('hide');
 
})
 
})

Latest revision as of 17:56, 17 October 2018

let fkpage;


$(document).ready(function () {

 loadPages();
 let dstPage = 0;
 urlSplit = window.location.href.split('?');
 if (urlSplit.length > 1) {
   dstPage = 0 + pageList.findIndex((value, index, arr) => {
     return value === urlSplit[1];
   });
 }
 // console.log(dstPage);
 fkpage = $('.myfkpage').FKPageTransitions({
   preventDefaultSwipeY: true,
   startSlide: dstPage,
   mode: 35,
   mouseWheel: false
 });
 let pageHeight = $(window).height();
 let pageWidth = document.documentElement.clientWidth || document.body.clientWidth;
 (function () {
   $('.myfkpage').css('height', pageHeight + 'px');
   // console.log(pageHeight);
 })();


 // console.log(pageHeight);
 // console.log(pageWidth);
 $('#home-video').css('width', pageWidth + 'px');
 $('#home-video').css('height', pageHeight + 'px');
 // $('#home-video')[0].play();

});


$('.dropdown').dropdown({

 action: 'select'

}); $('.ui.dropdown.link.item').on('mouseenter', function () {

 $('.ui.dropdown.link.item').not($(this)).dropdown('hide');
 $(this).dropdown('show');

});

$('#home').on('mouseenter', function () {

 // console.log('hei');
 $('.ui.dropdown.link.item').dropdown('hide');

})