• Gallery -- 横向不断滚动 demo


    <%@ Page Language="C#" AutoEventWireup="true" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
    <style>
    .divTestimional {
    font-family: Helvetica, Arial, sans-serif;
    font-size: 16px;
    cursor: pointer;
    background-color: hsl(208, 65%, 98%);
    padding: 10px;
    }
    
    .divLocation {
    clear: both;
    padding-top: 5px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
    display: inline-block;
    float: left;
    padding-right: 85px;
    background: url("https://www.soldster.com/images/5stars.png") right top no-repeat;
    }
    
    .divText {
    clear: both;
     350px;
    padding-top: 10px;
    margin: 0;
    /*overflow: hidden;*/
    text-overflow: ellipsis;
    height: 100px;
    }
    
    ul, li {
    list-style: none;
    }
    
    #Marquee_x {
    overflow: hidden;
     100%;
    margin-top: 50px;
    }
    
    #Marquee_x ul li, #Marquee_x ul li div {
    float: left;
    }
    </style>
    <script>
    ; (function ($) {
    $.fn.jcMarquee = function (options) {
    var defaults = {
    'marquee': 'x',
    'margin_bottom': '0',
    'margin_right': '0',
    'speed': '5'
    };
    var options = $.extend(defaults, options);
    return this.each(function () {
    var $marquee = $(this),
    $marquee_scroll = $marquee.children('ul');
    $marquee_scroll.append("<li class='clone'>" + "</li>");
    $marquee_scroll.find('li').eq(0).children().clone().appendTo('.clone');
    var $marquee_left = $marquee_scroll.find('li');
    if (options.marquee == 'x') {
    var x = 0;
    $marquee_scroll.css('width', '1000%');
    $marquee_left.find('div').css({ 'margin-right': options.margin_right });
    $marquee_left.css({ 'margin-right': options.margin_right });
    function Marquee_x() {
    $marquee.scrollLeft(++x);
    _margin = parseInt($marquee_left.find('div').css('margin-right'));
    if (x == $marquee_left.width() + _margin) { x = 0 };
    };
    var MyMar = setInterval(Marquee_x, options.speed);
    $marquee.hover(function () {
    clearInterval(MyMar);
    }, function () {
    MyMar = setInterval(Marquee_x, options.speed);
    });
    }
    if (options.marquee == 'y') {
    var y = 0;
    $marquee_scroll.css('height', '1000%');
    $marquee_left.find('div').css('margin-bottom', options.margin_bottom);
    $marquee_left.css('margin-bottom', options.margin_bottom);
    function Marquee_y() {
    $marquee.scrollTop(++y);
    _margin = parseInt($marquee_left.find('div').css('margin-bottom'));
    if (y == $marquee_left.height() + _margin) { y = 0 };
    };
    var MyMar = setInterval(Marquee_y, options.speed);
    $marquee.hover(function () {
    clearInterval(MyMar);
    }, function () {
    MyMar = setInterval(Marquee_y, options.speed);
    });
    };
    });
    };
    })(jQuery)
    $(function () {
    $('#Marquee_x').jcMarquee({ 'marquee': 'x', 'margin_right': '10px', 'speed': 30 });
    });
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    
    <div style=" 1150px; margin: 10px auto;">
    <div style=" 100%; margin-top: 30px;">
    <div style="height: 20px; display: block">
    <a style="float: right; cursor: pointer;" href="https://www.baidu.com/"> >> Review All</a>
    
    </div>
    <div id="Marquee_x">
    <ul>
    <li style="list-style-type: inherit">
    <% List<Testimonial> records = GetData();
    foreach (Testimonial t in records)
    { 
    %>
    <div class="divTestimional">
    
    <b><%=t.Who %></b>
    <label style="float: right;"><%=t.CreatedAt.ToString("MMM-dd yyyy") %></label>
    <p class="divLocation">
    <%=t.Location %>&nbsp;
    </p>
    <p class="divText">
    <%=t.Text %>
    </p>
    </div>
    <%
    }
    %>
    </li>
    </ul>
    </div>
    </div>
    </div>
    
    
    </form>
    </body>
    </html>

    这是效果图(chrom):一直往左边滚动 , 具体不解释了,写个博客留作备份。

  • 相关阅读:
    Spring中的资源加载
    分布式系统Paxos算法
    MySQL中MyISAM与InnoDB区别及选择(转)
    Unable to construct api.Node object for kubelet: can't get ip address of node master.example.com: lookup master.example.com on : no such host
    分库情况下的数据库连接注入
    Core源码(二) Linq的Distinct扩展
    B-Tree详解
    C#进阶之路(八)集合的应用
    重温CLR(十八) 运行时序列化
    重温CLR(十七)程序集加载和反射
  • 原文地址:https://www.cnblogs.com/hanliping/p/4155975.html
Copyright © 2020-2023  润新知