こんにちは。下記の質問を参照したのですが、解決法が書かれていなかったので質問をします。
https://teratail.com/questions/113229
現在下のサイトへtarget="blank"で飛ばす設定をしているのですが、別タブに遷移したあと、さらに元ページまで該当URLに遷移してしまいます。(つまり、2つ同じページができてしまう)
https://impfood.mfds.go.kr/#!CFAAA01F050
どうやら#の記載がダメらしく、ふつうにトップに飛ばすと問題は起こりません。
作製中のページなので細かいコードはお見せできませんが、テンプレとなっているページは下記です。
https://www.jetro.go.jp//world/asia/kr/foods/exportguide/beef
テンプレページでは同様の問題はおこらないのでなぜバグが起こっているのかわからないでおります。
非常に大きなページなのですが、
もしわかる方がいればご助言お願いいたします。
--追加--
おそらく下記のコードが怪しいのではないかと気づいたので追記します。
https://www.jetro.go.jp/library/new/common/asset_js/180305/jquery.common.js
内の記述です。
js
1//----------------------------------------------------- 2// -tab_changer 3//----------------------------------------------------- 4 5 var tab_changer = (function (window, document, $) { 6 var elem = {}; 7 8 function init(){ 9 elem = $('.checkTab'); 10 elem.each(function(){ 11 var _this = $(this); 12 _this.find('.tabBox').hide(); 13 _this.find('.tabBox').eq(0).show(); 14 if ( _this.find('.tabNav').is('.var_link') ) { 15 } else { 16 _this.find('.tabNav li:eq(0)').addClass('on'); 17 _this.find('.tabNav li').each(function(){ 18 $("a", this).attr("aria-selected", $(this).is(".on")).attr("tabindex", ($(this).is(".on")) ? 0 : -1); 19 }); 20 } 21 var _title_number = _this.find('.tabNav li').length; 22 _this.find('.tabNav li').css({ 23 'box-sizing': 'border-box', 24 'width': 100/_title_number +'%' 25 }); 26 }); 27 tab_changer.click(); 28 } 29 30 function click(){ 31 elem.find('.tabNav li').on('click',function(e){ 32 var _this = $(this); 33 if ( _this.closest('.tabNav').is('.var_link') ) { 34 } else { 35 var _this_parent = _this.closest('.checkTab'); 36 var _click_number = _this.index(); 37 _this_parent.find('.tabBox').hide(); 38 _this_parent.find('.tabBox').eq(_click_number).fadeIn('slow'); 39 _this_parent.find('.tabNav li.on').removeClass('on').find(".hosoku").remove(); 40 _this_parent.find('.tabNav li').eq(_click_number).addClass('on'); 41 _this_parent.find('.tabNav li').each(function(){ 42 $("a", this).attr("aria-selected", $(this).is(".on")).attr("tabindex", ($(this).is(".on")) ? 0 : -1); 43 }); 44 return false; 45 } 46 }); 47 elem.find('.tabNav li a').on('keyup',function(e){ 48 var _this = $(this); 49 if ( _this.closest('.tabNav').is('.var_link') ) { 50 } else { 51 switch (e.keyCode) { 52 case 37: //left 53 _this.parents("li").prev().find("a").click().focus(); 54 break; 55 case 39: //right 56 _this.parents("li").next().find("a").click().focus(); 57 break; 58 }; 59 return false; 60 } 61 }); 62 } 63 64 return { 65 elem: elem, 66 init: init, 67 click: click 68 }; 69 })(window, document, jQuery); 70 71 $(function(){ 72 tab_changer.init(); 73 74 $(window).bind('beforeunload', function() { 75 $(".tabNav[id]:not(.var_link)").each(function(){ 76 var date = new Date(); 77 date.setTime( date.getTime() + ( 120 * 60 * 1000 )); 78 $.cookie('tab_'+$(this).attr("id"), $("li", this).index($(".on", this)), { expires: date, path:'/' }); 79 }); 80 }); 81 82 $(".tabNav:not(.var_link, [id])").each(function(i){ 83 $(this).attr("id", "tab"+crc32(location.pathname)+(i)); 84 }); 85 86 $(".tabNav[id]:not(.var_link)").each(function(){ 87 var tabon = $.cookie('tab_'+$(this).attr("id")); 88 89 if ($(this).is($(location.hash.split("_")[0]))) { 90 tabon = location.hash.split("_")[1] - 1; 91 } 92 93 if (tabon != null) { 94 $("li:eq("+tabon+") a", this).click(); 95 } 96 }); 97 98 $(document).on("click", "a.tabsw[href^='#']", function(){ 99 var sw = $(this).attr("href"); 100 101 if ($(sw.split("_")[0]).length > 0) { 102 var tabon = sw.split("_")[1] - 1 103 $("li:eq("+tabon+") a", $(sw.split("_")[0])).click(); 104 } 105 106 return false; 107 }); 108 });
このコードに a.tabsw[href^='#']" という部分があり、ここか?と疑っています。
回答1件
あなたの回答
tips
プレビュー