<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Elastic Header Example ![](https://box.kancloud.cn/2016-01-03_5688e1aa0a69c.png) html ``` <!-- template for the component --> <script type="x/template" id="header-view-template"> <div class="draggable-header-view" @mousedown="startDrag" @touchstart="startDrag" @mousemove="onDrag" @touchmove="onDrag" @mouseup="stopDrag" @touchend="stopDrag" @mouseleave="stopDrag"> <svg class="bg" width="320" height="560"> <path :d="headerPath" fill="#3F51B5"></path> </svg> <div class="header"> <slot name="header"></slot> </div> <div class="content" :style="contentPosition"> <slot name="content"></slot> </div> </div> </script> <draggable-header-view> <template slot="header"> <h1>Elastic Draggable SVG Header</h1> <p>with <a href="http://vuejs.org" target="_blank">Vue.js</a> + <a href="http://dynamicsjs.com" target="_blank">dynamics.js</a></p> </template> <template slot="content"> <p>Note this is just an effect demo - there are of course many additional details if you want to use this in production, e.g. handling responsive sizes, reload threshold and content scrolling. Those are out of scope for this quick little hack. However, the idea is that you can hide them as internal details of a Vue.js component and expose a simple Web-Component-like interface.</p> </template> </draggable-header-view> ``` js ``` document.body.addEventListener('touchmove', function (e) { e.preventDefault() }) Vue.component('draggable-header-view', { template: '#header-view-template', data: function () { return { dragging: false, // quadratic bezier control point c: { x: 160, y: 160 }, // record drag start point start: { x: 0, y: 0 } } }, computed: { headerPath: function () { return 'M0,0 L320,0 320,160' + 'Q' + this.c.x + ',' + this.c.y + ' 0,160' }, contentPosition: function () { var dy = this.c.y - 160 var dampen = dy > 0 ? 2 : 4 return { transform: 'translate3d(0,' + dy / dampen + 'px,0)' } } }, methods: { startDrag: function (e) { e = e.changedTouches ? e.changedTouches[0] : e this.dragging = true this.start.x = e.pageX this.start.y = e.pageY }, onDrag: function (e) { e = e.changedTouches ? e.changedTouches[0] : e if (this.dragging) { this.c.x = 160 + (e.pageX - this.start.x) // dampen vertical drag by a factor var dy = e.pageY - this.start.y var dampen = dy > 0 ? 1.5 : 4 this.c.y = 160 + dy / dampen } }, stopDrag: function () { if (this.dragging) { this.dragging = false dynamics.animate(this.c, { x: 160, y: 160 }, { type: dynamics.spring, duration: 700, friction: 280 }) } } } }) new Vue({ el: 'body' }) ``` css ``` h1 { font-weight: 300; font-size: 1.8em; margin-top: 0; } a { color: #fff; } .draggable-header-view { background-color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.15); width: 320px; height: 560px; overflow: hidden; margin: 30px auto; position: relative; font-family: 'Roboto', Helvetica, Arial, sans-serif; color: #fff; font-size: 14px; font-weight: 300; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .draggable-header-view .bg { position: absolute; top: 0; left: 0; z-index: 0; } .draggable-header-view .header, .draggable-header-view .content { position: relative; z-index: 1; padding: 30px; box-sizing: border-box; } .draggable-header-view .header { height: 160px; } .draggable-header-view .content { color: #333; line-height: 1.5em; } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看