0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[jQuery] LeaveNotice jQuery Plugin で外部リンクの場合、一旦ポップアップを表示させる

Posted at

通常のホームページに設置される外部リンクをクリックされた場合、そのまま遷移させるのではなく、一旦ポップアップを表示させ、「本当に良いですか?」的なのを挟むような機能を求められました。

ググってみたら、LeaveNotice jQuery Plugin が良さそうだったので、導入しました。

<script language="javascript" type="text/javascript" src="js/jquery.1.7.1.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.leaveNotice.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.leaveNotice.css">

<a href="sample.com" class="externallink">リンク</a>

<script type="text/javascript">
$(function(){
  $('a.externallink').leaveNotice();
});
</script>

#参考URL
rewdy/leaveNotice: A jQuery plugin for notifying users of their exiting a page.
LeaveNotice Example
外部リンクに対してメッセージを表示できるjQueryプラグイン「LeaveNotice jQuery Plugin」 | BlackFlag

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?