app.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*=====================================================
  2. Javascript Editable
  3. ======================================================*/
  4. $(document).ready(function(){
  5. /*=== testimonial Slider ====*/
  6. $(".testimonial-slider").slick({
  7. autoplay: false,
  8. slidesToScroll: 1,
  9. dots: true,
  10. fade: true,
  11. infinite: true,
  12. arrows: false,
  13. });
  14. /* smooth scroll */
  15. $(function() {
  16. $('.scroll').click(function() {
  17. if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
  18. var target = $(this.hash);
  19. target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  20. if (target.length) {
  21. $('html, body').animate({
  22. scrollTop: target.offset().top - 0
  23. }, 800);
  24. return false;
  25. }
  26. }
  27. });
  28. });
  29. });
  30. // 更新Bootstrap中的Dropdown下拉菜单更改为悬停(hover)触发
  31. $(document).ready(function(){
  32. // 关闭click.bs.dropdown.data-api事件,使顶级菜单可点击
  33. $(document).off('click.bs.dropdown.data-api');
  34. // 鼠标划过就展开子菜单,免得需要点击才能展开
  35. $('li.dropdown').mouseover(function(){
  36. $(".dropdown-menu").hide();
  37. $(this).find(".dropdown-menu").show();
  38. })
  39. // 离开导航栏就隐藏所有的子栏目
  40. $(".header").mouseleave(function(){
  41. $(".dropdown-menu").hide();
  42. });
  43. });