2017-04-05 42 views
1

如何在页面加载上运行两个不同的jquery,但一个接一个?

mounted: function() { 
 
     $(function(){ 
 
      $(document).ready(function(){ 
 
      Tour.run([ 
 
       { 
 
       element: $('#interest'), 
 
       content: 'by default tour is on the right' 
 
       }, 
 
       { 
 
       element: $('#course'), 
 
       content: 'but it can be on top', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#trade'), 
 
       content: 'bottom', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#district'), 
 
       content: 'and finally on the left', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#InstituteSearch'), 
 
       content: 'and finally on the left', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#btn-search'), 
 
       content: 'and finally on the left', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#btn-claear'), 
 
       content: 'and finally on the left', 
 
       position: 'right' 
 
       } 
 
      ]); 
 
      }); 
 
     }); 
 
    (function($) { 
 
     $(document).ready(function() { 
 
      $.magnificPopup.open({ 
 
      items: { 
 
       src: 'https://www.youtube.com/watch?v=K8E6xsac2MU' 
 
      }, 
 
      type: 'iframe' 
 
      }, 0); 
 
     }); 
 
     })(jQuery); 
 
    },

我有两个jQuery插件。一个是覆盖&另一个是弹出式视频。两者都在页面加载时执行。我希望首先在页面加载时弹出视频。关闭视频后,叠加层的jquery应该执行。

回答

1

将第一个声明为在关闭视频弹出窗口时关闭时运行的函数。

$.magnificPopup.open({ 
      items: { 
       src: 'https://www.youtube.com/watch?v=K8E6xsac2MU' 
      }, 
      type: 'iframe', 
      close: function() { 
       // Will fire when popup is closed 
       TourRun(); 
        } 
      }, 0); 
     }); 
-1

mounted: function() { 
 
     $(function(){ 
 
      $(document).ready(function(){ 
 

 
     $.magnificPopup.open({ 
 
      items: { 
 
       src: 'https://www.youtube.com/watch?v=K8E6xsac2MU' 
 
      }, 
 
      type: 'iframe', 
 
      close: function() { 
 
       // Will fire when popup is closed 
 

 
       Tour.run([ 
 
       { 
 
       element: $('#interest'), 
 
       content: 'by default tour is on the right' 
 
       }, 
 
       { 
 
       element: $('#course'), 
 
       content: 'but it can be on top', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#trade'), 
 
       content: 'bottom', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#district'), 
 
       content: 'and finally on the left', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#InstituteSearch'), 
 
       content: 'and finally on the left', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#btn-search'), 
 
       content: 'and finally on the left', 
 
       position: 'right' 
 
       }, 
 
       { 
 
       element: $('#btn-claear'), 
 
       content: 'and finally on the left', 
 
       position: 'right' 
 
       } 
 
      ]); 
 
      } 
 
      }, 0); 
 
     }); 
 
     }); 
 
       
 
    },

你好只显示视频弹出窗口,覆盖不运行

相关问题