首页 > 软件开发 > JQUERY >

html+css+jQuery动态响应式时间轴代码

来源:互联网 2023-03-16 23:54:27 93

html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

工具/原料

  • adobe dreamweaver

方法/步骤

  • 1

    准备好需要用到的图标。4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

  • 1本页面未经许可获取自百度经验
  • 2

    新建html文档。4VU办公区 - 实用经验教程分享!

  • 3

    书写hmtl代码。4VU办公区 - 实用经验教程分享!

    div class="jq22-container">4VU办公区 - 实用经验教程分享!

    div class="cntl"> span class="cntl-bar cntl-center"> span class="cntl-bar-fill">/span> /span>4VU办公区 - 实用经验教程分享!

    div class="cntl-states">4VU办公区 - 实用经验教程分享!

    div class="cntl-state">4VU办公区 - 实用经验教程分享!

    div class="cntl-content">4VU办公区 - 实用经验教程分享!

    h4>Title 1/h4>4VU办公区 - 实用经验教程分享!

    111111111111111111/4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-icon cntl-center">'00/div>4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-state">4VU办公区 - 实用经验教程分享!

    div class="cntl-content">4VU办公区 - 实用经验教程分享!

    h4>Title 2/h4>4VU办公区 - 实用经验教程分享!

    111111111111111111/4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-image">img src="img/a1.png">/div>4VU办公区 - 实用经验教程分享!

    div class="cntl-icon cntl-center">'03/div>4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-state">4VU办公区 - 实用经验教程分享!

    div class="cntl-content">4VU办公区 - 实用经验教程分享!

    h4>Title 3/h4>4VU办公区 - 实用经验教程分享!

    111111111111111111/4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-image">img src="img/a2.png">/div>4VU办公区 - 实用经验教程分享!

    div class="cntl-icon cntl-center">'04/div>4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-state">4VU办公区 - 实用经验教程分享!

    div class="cntl-content">4VU办公区 - 实用经验教程分享!

    h4>Title 4/h4>4VU办公区 - 实用经验教程分享!

    111111111111111111/4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-image">img src="img/a3.png">/div>4VU办公区 - 实用经验教程分享!

    div class="cntl-icon cntl-center">'07/div>4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-state">4VU办公区 - 实用经验教程分享!

    div class="cntl-content">4VU办公区 - 实用经验教程分享!

    h4>Title 5/h4>4VU办公区 - 实用经验教程分享!

    111111111111111111/4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    div class="cntl-image">img src="img/a4.png">/div>4VU办公区 - 实用经验教程分享!

    div class="cntl-icon cntl-center">'10/div>4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    /div>4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

  • 4

    书写css代码。4VU办公区 - 实用经验教程分享!

    body { font-family: Arial; }4VU办公区 - 实用经验教程分享!

    .cntl { position: relative; width: 100%; overflow: hidden; }4VU办公区 - 实用经验教程分享!

    .cntl-center { left: 0; right: 0; margin-left: auto; margin-right: auto; }4VU办公区 - 实用经验教程分享!

    .cntl-bar { position: absolute; width: 10px; top: 0; bottom: 0; background-color: #ccc; box-shadow: inset 0px 0px 7px -2px #000; }4VU办公区 - 实用经验教程分享!

    .cntl-bar-fill { background-color: #009ABB; position: absolute; left: 0; right: 0; top: 0; height: 0; }4VU办公区 - 实用经验教程分享!

    .cntl-state { position: relative; width: 100%; min-height: 200px; margin-bottom: 50px; }4VU办公区 - 实用经验教程分享!

    .cntl-state::after { display: block; content: ' '; clear: both; }4VU办公区 - 实用经验教程分享!

    .cntl-icon { border-radius: 50%; width: 80px; height: 80px; background-color: #00313C; border: solid 3px #009ABB; box-shadow: 0px 0px 19px -9px #000; position: absolute; top: 0; text-align: center; line-height: 80px; font-size: 40px; color: #fff; }4VU办公区 - 实用经验教程分享!

    .cntl-content { width: 40%; padding: 2%; background-color: rgba(238, 238, 238, 0.25); border-radius: 8px; border-bottom: solid 3px #009ABB; float: left; opacity: 0; position: relative; margin-left: -40%; }4VU办公区 - 实用经验教程分享!

    .cntl-state:nth-child(2n 2) .cntl-content { float: right; margin-right: -40%; }4VU办公区 - 实用经验教程分享!

    .cntl-image { opacity: 0; width: 40%; padding: 2%; }4VU办公区 - 实用经验教程分享!

    .cntl-state:nth-child(2n 1) .cntl-image { float: right; }4VU办公区 - 实用经验教程分享!

    .cntl-image img { width: 100%; }4VU办公区 - 实用经验教程分享!

    .cntl-content h4 { font-size: 20px; font-weight: normal; margin-bottom: 10px; }4VU办公区 - 实用经验教程分享!

    .cntl-bar-fill, .cntl-content, .cntl-image { -webkit-transition: all 500ms ease; -moz-transition: all 500ms ease; -o-transition: all 500ms ease; -ms-transition: all 500ms ease; transition: all 500ms ease; }4VU办公区 - 实用经验教程分享!

    .cntl-state:nth-child(2n 2).cntl-animate .cntl-content { margin-right: 0%; }4VU办公区 - 实用经验教程分享!

    .cntl-animate .cntl-content { opacity: 1; margin-left: 0%; }4VU办公区 - 实用经验教程分享!

    .cntl-animate .cntl-image { opacity: 1; }4VU办公区 - 实用经验教程分享!

    @media (max-width: 600px) {4VU办公区 - 实用经验教程分享!

    .cntl-bar { left: auto; right: 37px; }4VU办公区 - 实用经验教程分享!

    .cntl-content { width: 80%; float: none; }4VU办公区 - 实用经验教程分享!

    .cntl-state:nth-child(2n 2) .cntl-content { margi-right: 0%; float: none; }4VU办公区 - 实用经验教程分享!

    .cntl-image { width: 80%; }4VU办公区 - 实用经验教程分享!

    .cntl-state:nth-child(2n 1) .cntl-image { float: none; }4VU办公区 - 实用经验教程分享!

    .animate .cntl-content { margin-left: 2%; }4VU办公区 - 实用经验教程分享!

    .cntl-icon { left: auto; right: 0; }4VU办公区 - 实用经验教程分享!

    }4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

  • 5

    书写并添加js代码。4VU办公区 - 实用经验教程分享!

    script src="js/jquery.min.js">/script>4VU办公区 - 实用经验教程分享!

    script src="lib/jquery.cntl.js">/script>4VU办公区 - 实用经验教程分享!

    script >4VU办公区 - 实用经验教程分享!

    $(document).ready(function(e){4VU办公区 - 实用经验教程分享!

    $('.cntl').cntl({4VU办公区 - 实用经验教程分享!

    revealbefore: 300,4VU办公区 - 实用经验教程分享!

    anim_class: 'cntl-animate',4VU办公区 - 实用经验教程分享!

    onreveal: function(e){4VU办公区 - 实用经验教程分享!

    console.log(e);4VU办公区 - 实用经验教程分享!

    }4VU办公区 - 实用经验教程分享!

    });4VU办公区 - 实用经验教程分享!

    });4VU办公区 - 实用经验教程分享!

    /script>4VU办公区 - 实用经验教程分享!

  • 6

    书写jqueryjs代码。4VU办公区 - 实用经验教程分享!

    script>4VU办公区 - 实用经验教程分享!

    (function($) {4VU办公区 - 实用经验教程分享!

    $.fn.cntl = function( options ) {4VU办公区 - 实用经验教程分享!

    var settings = $.extend({4VU办公区 - 实用经验教程分享!

    revealbefore : 200,4VU办公区 - 实用经验教程分享!

    anim_class : 'cntl-animate',4VU办公区 - 实用经验教程分享!

    onreveal : null4VU办公区 - 实用经验教程分享!

    }, options);4VU办公区 - 实用经验教程分享!

    return this.each( function() {4VU办公区 - 实用经验教程分享!

    var statelist = $(this).find('.cntl-state');4VU办公区 - 实用经验教程分享!

    var bar_fill = $(this).find('.cntl-bar-fill');4VU办公区 - 实用经验教程分享!

    var states = [];4VU办公区 - 实用经验教程分享!

    var tbf = 0;4VU办公区 - 实用经验教程分享!

    function setupElements( )4VU办公区 - 实用经验教程分享!

    {4VU办公区 - 实用经验教程分享!

    for (var i = 0; i statelist.length; i ) {4VU办公区 - 实用经验教程分享!

    states[i] = {};4VU办公区 - 实用经验教程分享!

    states[i]['top'] = $(statelist[i]).offset().top settings.revealbefore;4VU办公区 - 实用经验教程分享!

    states[i]['elm'] = $(statelist[i]);4VU办公区 - 实用经验教程分享!

    };4VU办公区 - 实用经验教程分享!

    revealElements();4VU办公区 - 实用经验教程分享!

    }4VU办公区 - 实用经验教程分享!

    function revealElements( )4VU办公区 - 实用经验教程分享!

    {4VU办公区 - 实用经验教程分享!

    var windowtop = $(window).scrollTop();4VU办公区 - 实用经验教程分享!

    var windowbtm = windowtop $(window).height();4VU办公区 - 实用经验教程分享!

    for( var i = 0; i states.length; i ) {4VU办公区 - 实用经验教程分享!

    if( states[i].top > windowtop && states[i].top windowbtm )4VU办公区 - 实用经验教程分享!

    {4VU办公区 - 实用经验教程分享!

    if (4VU办公区 - 实用经验教程分享!

    !states[i].elm.hasClass( settings.anim_class ) &&4VU办公区 - 实用经验教程分享!

    $.isFunction( settings.onreveal ) )4VU办公区 - 实用经验教程分享!

    {4VU办公区 - 实用经验教程分享!

    settings.onreveal.call( this, states[i].elm );4VU办公区 - 实用经验教程分享!

    }4VU办公区 - 实用经验教程分享!

    states[i].elm.addClass( settings.anim_class );4VU办公区 - 实用经验教程分享!

    var h = states[i].elm.position().top;4VU办公区 - 实用经验教程分享!

    if( h > tbf )4VU办公区 - 实用经验教程分享!

    {4VU办公区 - 实用经验教程分享!

    tbf = h;4VU办公区 - 实用经验教程分享!

    }4VU办公区 - 实用经验教程分享!

    bar_fill.height( tbf );4VU办公区 - 实用经验教程分享!

    }4VU办公区 - 实用经验教程分享!

    };4VU办公区 - 实用经验教程分享!

    }4VU办公区 - 实用经验教程分享!

    $(window).on('scroll',revealElements);4VU办公区 - 实用经验教程分享!

    $(window).on('load',setupElements)4VU办公区 - 实用经验教程分享!

    });4VU办公区 - 实用经验教程分享!

    }4VU办公区 - 实用经验教程分享!

    }(jQuery));4VU办公区 - 实用经验教程分享!

    /script>4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

  • 7

    代码整体结构。4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

  • 8

    查看效果。4VU办公区 - 实用经验教程分享!

    html css jQuery动态响应式时间轴代码4VU办公区 - 实用经验教程分享!

  • 注意事项

    • jquery.min.js是个js包,可以网上下载。

    以上方法由办公区教程网编辑摘抄自百度经验可供大家参考!4VU办公区 - 实用经验教程分享!


    标签: CSSHTMLJQUERY

    办公区 Copyright © 2016-2023 www.bgqu.net. Some Rights Reserved. 备案号:湘ICP备2020019561号统计代码