http://low-cost-travel.lk6.co/test109.php
■test109.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="ja"> <head> <title>jquery ipop_multi.jsのサンプル</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="./test109.js"></script></html> ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー ■test109.js<script type="text/javascript"> $(function() { $('#open1').click(function() { $("#mado1").ipop(); } ); if ($('#kwd').text() != '') { $('#open1').click(); } }); </script> <style type="text/css"> .ipop { padding: 0; background-color: #fed; width: 300px; height: 200px; border: 1px solid #aaa; /* この3行は必須 */ position: absolute; display: none; z-index: 9999; } .ipop_search { padding: 0; background-color: #fed; width: 300px; height: 400px; border: 1px solid #aaa; /* この3行は必須 */ position: absolute; display: none; z-index: 9999; } .ipop_title { background-color: #fdc; cursor: move; } .ipop_close { cursor: pointer; float: right; } </style> <title>ポップアップウインドウテスト</title> </head> <body> <a href=./test109.php?id=1>テスト0</a><br> <?php if ($_GET["id"] == "1") { echo "テスト1<br>"; } ?> <input type='button' value='検 索' id='open1'> <div class="ipop_search" id="mado1"> <div class="ipop_close">×</div> <div class="ipop_title">検索</div> <?php echo "<form action='./test109.php' method='post'>"; echo"<input type='text' name='keyword' style='width:240px;'><input type='submit' value='検索'>"; echo "<form>"; $keyword = $_POST['keyword']; echo '<div id="kwd">'.$keyword.'</div>'; ?> </div> </body>
(function($) {
$.fn.ipop = function() {
var $this = $(this); var wx, wy; // ウインドウの左上座標 var mx, my; // マウスの座標 // ウインドウの座標を画面中央にする。 wx = $(document).scrollLeft() + ($(window).width() - $(this).outerWidth()) / 2; if (wx < 0) wx = 0; wy = $(document).scrollTop() + ($(window).height() - $(this).outerHeight()) / 2; if (wy < 0) wy = 0; // ポップアップウインドウを表示する。 $this.css('top', wy).css('left', wx).fadeIn(100); // 閉じるボタンを押したとき $this.find('.ipop_close').click(function(){ $this.fadeOut(100);}); // タイトルバーをドラッグしたとき $this.find('.ipop_title').mousedown(function(e) { mx = e.pageX; my = e.pageY; $(document).mousemove(mouseMove).mouseup(mouseUp); return false; }); function mouseMove(e) { wx += e.pageX - mx; wy += e.pageY - my; $this.css('top', wy).css('left', wx); mx = e.pageX; my = e.pageY; return false; } function mouseUp() { $(document).unbind('mousemove', mouseMove).unbind('mouseup', mouseUp); } }
})(jQuery);
このプログラムでは検索のダイアログを開いてキーワードを入れて検索を
押せばダイアログが消えず結果が表示されるものとなっております。
検索のダイアログを開いてどのページに移動しても最初に開いた
検索のダイアログがそのまま表示されている状態か、あるいは
キーワードを検索して結果が表示されたままの状態を維持して
他のページに移動したとしても検索のダイアログが消えない状態に
するにはどうすればよろしいでしょうか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2015/06/10 03:11
2015/06/10 10:34
2015/06/10 10:35
退会済みユーザー
2015/06/10 11:34
退会済みユーザー
2015/06/10 13:45
2015/06/10 15:11