\r\n\r\n \r\n\r\n\r\n\r\n -->\r\n\r\n\r\n
\r\n\t
my country
\r\n\t
\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\t\r\n\t
\t\r\n\t\t\t\r\n
\r\n
\r\n\t
\r\n\t\t
\r\n\t\t\t

Sample

\r\n\t\t\t

Welcome to Sweden

\r\n\t\t
\r\n\t
\t\r\n
\r\n \t\t
\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\t

You know about sweden?

\r\n\t\t\t
\t\r\n\t\t
\r\n\t
\t\t\t\r\n
\r\n\t\t
\r\n\t\t\t\r\n\t\t\t
City view
\r\n\t\t
\r\n\t\t
\r\n\t\t\t\r\n\t\t\t
Fika
\r\n\t\t
\r\n\t\t
\r\n\t\t\t\r\n\t\t\t
Utflykt
\r\n\t\t
\r\n\t
\t\r\n\t
\r\n\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t
\t\r\n\t\r\n
\t\r\n\r\n\t\r\n\t\r\n```\r\n\r\n\r\n\r\n```\r\nbody{\r\n\tpadding:0;\r\n\tmargin:0;\r\n}\r\na{\r\n\ttext-decoration: none;\r\n}\r\nheader{\r\n\tposition:fixed;\r\n\ttop:0px;\r\n\tleft:0px;\r\n\twidth:100%;\r\n\theight:8em;\r\n\tbackground-color: #FA58D0;\r\n\t-webkit-transition: all 0.4s;\r\n\t-ms-transition: all 0.4s;\r\n\t-moz-transition: all 0.4s;\r\n\t-o-transition: all 0.4s;\r\n\ttransition: all 0.4s;\r\n\t\r\n\tz-index:999;\r\n}\r\n.title{\r\n\tfont-size: 40px;\r\n\tcolor:white;\r\n\tfont-family: arial black;\r\n\tposition:absolute;\r\n\tleft: 5%;\r\n\ttop:50%;\r\n\tmargin:auto;\r\n\ttransform: translateY(-50%);\r\n\t\r\n}\r\n\r\n.navToggle{\r\n\tdisplay:none;\r\n\tposition:absolute;/*bodyに対しての絶対位置指定*/\r\n\tright:20px;\r\n\ttop:0;\r\n\tbottom:0;\r\n\tmargin:auto;\r\n\twidth:30px;\r\n\theight:25px;\r\n\tcursor:pointer;\r\n\tborder:solid 1px white;\r\n\tpadding:5px 5px 0 5px;\r\n border-radius: 5px;\r\n}\r\n.navToggle div{\r\n\tposition: relative; \r\n}\r\n.navToggle span{\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder-bottom:solid 3px white;\r\n\tmargin-bottom:5px;\r\n}\r\nheader ul{\r\n\tposition:absolute;\r\n\tright:5%;\r\n\ttop:0;\r\n\tbottom:0;\r\n\tmargin:auto;\r\n\tdisplay:table;\r\n\t-webkit-transition: max-height 0.4s;\r\n\t-ms-transition: max-height 0.4s;\r\n\t-moz-transition: max-height 0.4s;\r\n\t-o-transition: max-height 0.4s;\r\n\ttransition: max-height 0.4s;\r\n}\r\nheader ul li{\r\n\tborder-right:solid white 0.5px;\r\n\tcolor:black;\r\n\tdisplay:table-cell;\r\n\tpadding-right:10px;\r\n\tpadding-left: 10px;\r\n\tfont-size: 15px;\r\n\tcursor:pointer;\r\n}\r\nheader ul li a{\r\n\tcolor:black; \r\n}\r\n.header_scrolled{\r\n\theight:4em;\r\n}\r\n\r\n@media screen and (max-width:780px){\r\n\t.navToggle{\r\n\t\tdisplay:block;\r\n\t}\r\n\t.showing{ /*このクラスをjqueryでulに追加する*/\r\n\t\tbottom:0;\r\n left:0;\r\n right:0;\r\n max-height:20em;\r\n\t}\r\n\theader ul{\r\n\t\tmax-height: 0; \r\n\t\tposition:relative;\r\n\t\t/* topはjqueryで変える */\r\n\t\tright:0px;\r\n\t\tdisplay:block; \r\n\t\twidth:100%;\r\n\t\tpadding:0;\r\n\t\toverflow: hidden; \r\n\t\tbackground-color:rgba(0,0,0,0.8);\r\n\t}\r\n\theader ul li{\r\n\t\tbox-sizing:border-box;\r\n\t\twidth:100%; \r\n\t\tpadding:15px;\r\n\t\tdisplay:block;\r\n\t\ttext-align: center;\r\n\t\tborder-bottom:solid 1px #777;\r\n\t}\r\n header ul li a {\r\n\t\tcolor:white;\r\n\t}\t\r\n}\r\n\r\n.main{\r\n\tmargin-top:128px;\r\n\ttext-align: center;\r\n\tbackground: #FA58D0;\r\n\tcolor:white;\r\n\twidth:100%;\r\n\theight:400px;\r\n}\r\n.main h1{\r\n\tfont-size: 100px;\r\n}\r\n.main h2{\r\n\tfont-size: 50px;\r\n}\r\n.main2{\r\n\theight:400px;\r\n\tpadding:40px;\r\n}\r\n\t.main2 img{\r\n\t\tfloat:left;\r\n\t\twidth:50%;\r\n\t}\r\n\t.main2_explain{\r\n\t\tfloat:right;\r\n\t\twidth:50%;\r\n\t\ttext-align: center;\r\n\t}\r\n\t.main2_explain h1{\r\n\t\tborder-left: #FA58D0 solid 7px;\r\n\t\tmargin-left: 20px;\r\n\t}\r\n.picture{\r\n\tfloat:left;\r\n\twidth:33.333%;\r\n\topacity:0;\r\n\ttransform: translate(0,40px); \r\n\t-webkit-transform: translate(0,40px);\r\n\ttransition:0.8s;\r\n}\r\n.inview_picture{\r\n\topacity:1;\r\n\tmargin-top: 40px;\r\n\ttransform: translate(0,0); \r\n\t-webkit-transform: translate(0,0);\r\n}\r\n.picture img{\r\n\tcursor: pointer;\r\n\theight:200px;\r\n\tdisplay: block;\r\n\tmargin:0 auto;\r\n\ttransition: max-height 0.4s;\r\n}\r\n.picture img:hover{\r\n\topacity:0.8;\r\n}\r\n.pic_title{\r\n\ttext-align: center;\r\n\tfont-size: 20px;\r\n\tfont-family: arial-black;\r\n\tcolor:#777;\r\n\tfont-weight: 700;\r\n\tpadding-top: 20px;\r\n}\r\n@media screen and (max-width:780px){\r\n\t.picture{\r\n\t\twidth:100%;\r\n\t\tmargin:0 auto;\r\n\t\tmargin-bottom: 20px;\r\n\t}\r\n\t.main2 img{\r\n\t\twidth:100%;\r\n\t}\r\n\t.main2_explain{\r\n\t\twidth:100%;\r\n\t}\r\n}\t\r\n\r\n/*スライドslick部分*/\r\n/*左右の矢印の色を変える*/\r\n.slider{\r\n\theight:200px;\r\n\toverflow: hidden; \r\n}\r\n.slick-prev:before,\r\n.slick-next:before {\r\n color: #000;\r\n}\r\n\r\n.slick-next {\r\n right: 20px;\r\n z-index: 99;\r\n}\r\n.slick-prev {\r\n left: 15px;\r\n z-index: 100;\r\n}\r\n\r\n.slick-dots li.slick-active button:before,\r\n.slick-dots li button:before {\r\n color: #fff;\r\n}\r\n\r\nimg {\r\n max-width: 100%;\r\n height: auto;\r\n}\r\n```","answerCount":2,"upvoteCount":0,"datePublished":"2017-05-21T09:57:52.173Z","dateModified":"2017-05-21T09:57:52.173Z","acceptedAnswer":{"@type":"Answer","text":"```html\r\n\r\n```\r\n[と書くと一番上まで行ってしまうようです](https://oshiete.goo.ne.jp/qa/603581.html)\r\n```javascript\r\n$(\"a\").on(\"click\",function(){\r\n if($(this).attr(\"href\")==\"#\")return false;\r\n});\r\n```\r\nこれでも入れておけば大丈夫かも","dateModified":"2017-05-21T12:49:43.755Z","datePublished":"2017-05-21T12:47:07.151Z","upvoteCount":1,"url":"https://teratail.com/questions/77081#reply-121293"},"suggestedAnswer":[{"@type":"Answer","text":"どれかプラグインの中で#を使っているんだと思うので他の値にすればいいのでは。\r\nというかaタグを使っていないのならaタグを書いている意味が無いので書かなければOKみたいな^^","dateModified":"2017-05-23T12:55:32.439Z","datePublished":"2017-05-23T12:55:32.439Z","upvoteCount":0,"url":"https://teratail.com/questions/77081#reply-121813","comment":[]}],"breadcrumb":{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"トップ","url":"https://teratail.com"},{"@type":"ListItem","position":2,"name":"JavaScriptに関する質問","url":"https://teratail.com/tags/JavaScript"},{"@type":"ListItem","position":3,"name":"JavaScript","url":"https://teratail.com/tags/JavaScript"}]}}}
質問するログイン新規登録
JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

Q&A

解決済

2回答

2006閲覧

slicker使用部分で画像をクリックすると自動的に上にスクロールされる

kazoogon

総合スコア281

JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

0グッド

0クリップ

投稿2017/05/21 09:57

0

0

題名通りですがslicker使用部分の画像をクリックすると、勝手に上にスクロールされます。 複数ライブラリ使用が原因かと思っていますが、正直よくわかりません。。。

<!DOCTYPE html> <head> <meata lang="ja"> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="design.css"> <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inview/1.0.0/jquery.inview.min.js"></script> <!-- slickのライブラリ3つ↓ --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css"/> <link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick-theme.css"/> <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js"></script> </script> --> </head> <body> <header> <div class="title">my country</div> <div class="navToggle"> <div> <span></span> <span></span> <span></span> </div> </div> <ul> <li><a href="#">Home</a></li> <li><a href="#">What is it?</a></li> <li><a href="#">Contact</a></li> <li><a href="#">twitter</a></li> </ul> </header> <div id="fullpage"> <div class="section"> <div class="main"> <h1>Sample</h1> <h2>Welcome to Sweden</h2> </div> </div> <div class="section"> <div class="main2"> <img src="https://unnoticeableme13.files.wordpress.com/2013/07/party-girls-fun-happy-sweden.jpg"> <div class="main2_explain"> <h1>You know about sweden?</h1> </div> </div> </div> <div class="section"> <div class="picture"> <img src="http://s3.amazonaws.com/iexplore_web/images/assets/000/006/463/original/sweden.jpg?1443530953"> <div class="pic_title">City view</div> </div> <div class="picture"> <img src="http://331mrnu3ylm2k3db3s1xd1hg.wpengine.netdna-cdn.com/wp-content/uploads/2015/06/Sprudge-FIKANYC-RobertWolcheck-FIKA_NYC_coffee_cup_detail-1.jpg"> <div class="pic_title">Fika</div> </div> <div class="picture"> <img src="http://blogg.forskolankarten.se/wp-content/uploads/2014/03/skogen.jpg"> <div class="pic_title">Utflykt</div> </div> </div> <div> <!-- ############# この画像をクリックすると、上にスクロールされる ############# --> <!-- 写真のスライド(slick使用) --> <!-- http://gimmicklog.main.jp/jquery/549/ 参照 --> <ul class="slider"> <li><a href="#"><img src="http://blogs.sweden.se/photo/files/2011/03/Sandwiches-at-Kulturhuset.jpg"></a></li> <li><a href="#"><img src="http://www.dreamhomestyle.com/wp-content/uploads/2014/10/modern-Swedish-crib-9.jpg"></a></li> <li><a href="#"><img src="http://football-uniform.up.n.seesaa.net/football-uniform/image/Sweden-12-UMBRO-women-home-kit-yellow-yellow-yellow-line-up.jpg?d=a0"></a></li> <li><a href="#"><img src="http://static5.businessinsider.com/image/4f19eb6beab8ea5b3600006a-1200/sweden-school.jpg"></a></li> <li><a href="#"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Koettbullar_stockholm2006.jpg/330px-Koettbullar_stockholm2006.jpg"></a></li> <li><a href="#"><img src="http://i.pinimg.com/600x/44/04/01/440401336f847048f1b3fc6c6b4eccca.jpg"></a></li> </ul> </div> </div> <script> $('.navToggle').on('click',function(){ $('header ul').toggleClass('showing'); //toggleは二回押すと元通りになる(on,offの機能) }); //スクロール後にヘッダーの幅狭める // http://www.webopixel.net/javascript/1037.html 参照 $(function(){ var header = $('header'); $(window).scroll(function(){ if($(window).scrollTop() > 50){ header.addClass('header_scrolled'); }else{ header.removeClass('header_scrolled'); } }) }); //https://memocarilog.info/jquery/6500 if(window.matchMedia('(max-width:780px)').matches){ $('header ul').css("top","128px"); $(window).scroll(function(){ if($(window).scrollTop() > 50){ $('header ul').css("top","64px"); }else{ $('header ul').css("top","128px"); } }) } / $(function(){ $('.picture').on('inview',function(event,isInView,visiblePartX,visiblePartY){ if(isInView){ $(this).stop().addClass('inview_picture'); }else{ $(this).stop().removeClass('inview_picture'); } }); }); $(function() { $('.slider').slick({ infinite: true, dots:true, slidesToShow: 3, slidesToScroll: 1, responsive: [{ breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 1, } },{ breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, } } ] }); }); </script> </body>
body{ padding:0; margin:0; } a{ text-decoration: none; } header{ position:fixed; top:0px; left:0px; width:100%; height:8em; background-color: #FA58D0; -webkit-transition: all 0.4s; -ms-transition: all 0.4s; -moz-transition: all 0.4s; -o-transition: all 0.4s; transition: all 0.4s; z-index:999; } .title{ font-size: 40px; color:white; font-family: arial black; position:absolute; left: 5%; top:50%; margin:auto; transform: translateY(-50%); } .navToggle{ display:none; position:absolute;/*bodyに対しての絶対位置指定*/ right:20px; top:0; bottom:0; margin:auto; width:30px; height:25px; cursor:pointer; border:solid 1px white; padding:5px 5px 0 5px; border-radius: 5px; } .navToggle div{ position: relative; } .navToggle span{ display:block; width:100%; border-bottom:solid 3px white; margin-bottom:5px; } header ul{ position:absolute; right:5%; top:0; bottom:0; margin:auto; display:table; -webkit-transition: max-height 0.4s; -ms-transition: max-height 0.4s; -moz-transition: max-height 0.4s; -o-transition: max-height 0.4s; transition: max-height 0.4s; } header ul li{ border-right:solid white 0.5px; color:black; display:table-cell; padding-right:10px; padding-left: 10px; font-size: 15px; cursor:pointer; } header ul li a{ color:black; } .header_scrolled{ height:4em; } @media screen and (max-width:780px){ .navToggle{ display:block; } .showing{ /*このクラスをjqueryでulに追加する*/ bottom:0; left:0; right:0; max-height:20em; } header ul{ max-height: 0; position:relative; /* topはjqueryで変える */ right:0px; display:block; width:100%; padding:0; overflow: hidden; background-color:rgba(0,0,0,0.8); } header ul li{ box-sizing:border-box; width:100%; padding:15px; display:block; text-align: center; border-bottom:solid 1px #777; } header ul li a { color:white; } } .main{ margin-top:128px; text-align: center; background: #FA58D0; color:white; width:100%; height:400px; } .main h1{ font-size: 100px; } .main h2{ font-size: 50px; } .main2{ height:400px; padding:40px; } .main2 img{ float:left; width:50%; } .main2_explain{ float:right; width:50%; text-align: center; } .main2_explain h1{ border-left: #FA58D0 solid 7px; margin-left: 20px; } .picture{ float:left; width:33.333%; opacity:0; transform: translate(0,40px); -webkit-transform: translate(0,40px); transition:0.8s; } .inview_picture{ opacity:1; margin-top: 40px; transform: translate(0,0); -webkit-transform: translate(0,0); } .picture img{ cursor: pointer; height:200px; display: block; margin:0 auto; transition: max-height 0.4s; } .picture img:hover{ opacity:0.8; } .pic_title{ text-align: center; font-size: 20px; font-family: arial-black; color:#777; font-weight: 700; padding-top: 20px; } @media screen and (max-width:780px){ .picture{ width:100%; margin:0 auto; margin-bottom: 20px; } .main2 img{ width:100%; } .main2_explain{ width:100%; } } /*スライドslick部分*/ /*左右の矢印の色を変える*/ .slider{ height:200px; overflow: hidden; } .slick-prev:before, .slick-next:before { color: #000; } .slick-next { right: 20px; z-index: 99; } .slick-prev { left: 15px; z-index: 100; } .slick-dots li.slick-active button:before, .slick-dots li button:before { color: #fff; } img { max-width: 100%; height: auto; }

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

ベストアンサー

html

1<a href="#">

と書くと一番上まで行ってしまうようです

javascript

1$("a").on("click",function(){ 2 if($(this).attr("href")=="#")return false; 3});

これでも入れておけば大丈夫かも

投稿2017/05/21 12:47

編集2017/05/21 12:49
退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kazoogon

2017/05/22 12:59

ありがとうございます、上には行かなくなりました! しかしslickerが機能していないんですよね・・・・汗
退会済みユーザー

退会済みユーザー

2017/05/23 11:40

おてあげ・・・
guest

0

どれかプラグインの中で#を使っているんだと思うので他の値にすればいいのでは。
というかaタグを使っていないのならaタグを書いている意味が無いので書かなければOKみたいな^^

投稿2017/05/23 12:55

kyunta

総合スコア350

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.29%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問