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

Line 3: Line 3:
  
 
$(document).ready(function () {
 
$(document).ready(function () {
    
+
   let dstPage = 1;
 +
  urlSplit = window.location.href.split('#');
 +
  if (urlSplit.length > 1) {
 +
    dstPage = 1 + pageList.findIndex((value, index, arr) => {
 +
      return value === urlSplit[1];
 +
    });
 +
  }
 +
  console.log(dstPage);
  
 
   fkpage = $('.myfkpage').FKPageTransitions({
 
   fkpage = $('.myfkpage').FKPageTransitions({
 +
    startSlide: dstPage - 1,
 
     mode: 35,
 
     mode: 35,
 
     mouseWheel: false
 
     mouseWheel: false
 
   });
 
   });
 
   fkpage.goToNextSlide();
 
   fkpage.goToNextSlide();
   initTopBar("Home");
+
   initTopBar(pageList[dstPage]);
 +
 
 
   (function () {
 
   (function () {
 
     let pageHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
 
     let pageHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
Line 28: Line 37:
 
   $('.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() {

Revision as of 15:57, 11 October 2018

let fkpage;


$(document).ready(function () {

 let dstPage = 1;
 urlSplit = window.location.href.split('#');
 if (urlSplit.length > 1) {
   dstPage = 1 + pageList.findIndex((value, index, arr) => {
     return value === urlSplit[1];
   });
 }
 console.log(dstPage);
 fkpage = $('.myfkpage').FKPageTransitions({
   startSlide: dstPage - 1,
   mode: 35,
   mouseWheel: false
 });
 fkpage.goToNextSlide();
 initTopBar(pageList[dstPage]);
 
 (function () {
   let pageHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
   $('.myfkpage').css('height', pageHeight + 'px');
   console.log(pageHeight)
 })();

});

$('.myfkpage').children('li').each(function (index, ele) {

 $(this).addClass('test');

});

$('.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');

})