2016-05-13 93 views
-1

從1.4升級到v = 1.7jquery衝突後退按鈕代碼段

在這裏,我提出了幾個請求。

  1. jQuery的片段衝突
  2. 後退按鈕片斷

TypeError: $j(...).on is not a function

如何彈出警報,當有人點擊後退按鈕,下面是代碼,但看起來沒有工作,我仍然有一個更多的問題是是衝突的,你能否有人提出解決這個問題的最好方法。

jQuery(function() { 
    if (window.history && window.history.pushState) { 
     window.history.pushState('', null, './'); 
     jQuery(window).on('popstate', function() { 
      alert('Back button was pressed.'); 
      window.location.reload(); 
     }); 
    } 
}); 
+0

在jsfiddle上工作。 –

+0

@KalpeshSingh no bro – Bharanikumar

+2

@Bharanikumar - 如果有人不能重現你的問題,那麼這是一個好兆頭,你需要在你的測試用例中添加更多細節,直到他們可以。 – Quentin

回答