On the conversion of vue Writing

has just entered the industry, and now I am slowly learning that VUE now needs such a navigation function, but how to express it in the way of vue? Ask for a big god (and how to avoid being so blunt and smooth when you click to switch it)

< html >
< head >

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<style type="text/css">
    header {
        width: 100%;
        overflow: hidden;
        white-space: nowrap;
        overflow-x: scroll;
    }
    header::-webkit-scrollbar {
        display: none;
    }

    .nav {
        display: inline-block;
        margin-left: 15px;
        margin-right: 10px;
        height: 50px;
        line-height: 50px;

    }
</style>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

< / head >
< body >
< header >

<div class="nav">
    1
</div>
<div class="nav">
     2
</div>
<div class="nav">
     3
</div>
<div class="nav">
    4
</div>
<div class="nav">
     5
</div>
<div class="nav">
    6
</div>
<div class="nav">
     7
</div>
<div class="nav">
     8
</div>
<div class="nav">
     9
</div>
<div class="nav">
     10
</div>

< / header >
< script type= "text/javascript" >

$(function(){
    $(".nav").on("click",function(ev){
        var moveX = $(this).position().left+$(this).parent().scrollLeft();
        var pageX = document.documentElement.clientWidth;
        var blockWidth = $(this).width();
        var left = moveX-(pageX/2)+(blockWidth/2);
       $(this).css("color","red").siblings().css("color","-sharp000000");
        $("header").scrollLeft(left);


    })




});

< / script >
< / body >
< / html >

Dec.14,2021

to tell you the truth, basically no one will answer your question. The question is too simple (something that can be solved by looking at the document a little bit), and it is conscientious that no one will give you a step on or turn off the question.

go to the vue official website to take a look at the basic tutorials, know how to write vue, and then read the loop and transition chapters. If you use css3 (learn by yourself) in animation, you will make people think that you just want to reach out to someone for the code. The sf community does not advocate this kind of question and answer

.
Menu