如何自动滚动包含纯文本的 div(水平)?

发布于 2024-11-02 21:46:55 字数 567 浏览 0 评论 0原文

在此请多多包涵!我熟悉了基本的 HTML,并决定将 Web 编程作为我的职业。我报名了一个项目,现在正在第四学期编写我的第一个现场项目。我们的课程主要涉及 .NET Framework,我一般对 Javascript 和客户端编程非常不熟悉。

希望我概述的这些信息足以让这个社区的优秀成员有机会帮助崭露头角的开发人员。

目标:在页面上无限期地水平滚动包含纯文本的 div 环境:运行ASP.NET 4.0的Windows服务器。 语言:C#/XHTML/Javascript 使用的工具:jQuery、jQueryTools、SmoothDivScroll

我尝试使用名为 SmoothDivScroll 的 jQuery 插件以及 jQueryTools 来执行我的目标,但是,由于我缺乏客户端经验,我完全没有成功。

我的网页位于 http://paysonfirst assembly.com/ ,我尝试滚动的 div 有一个类和滚动面板的 ID。

如果有帮助的话我可以提供示例代码。

——泰勒

Please bear with me here! I familiarized myself with basic HTML and decided web programming would be my occupation. I enrolled in a program and am now writing my first live project in my fourth semester. Our classes deal mainly in the .NET Framework and I am very unfamiliar with Javascript and client-side programming in general.

Hopefully I outline this information enough to give the great members of this community a chance to help a budding developer.

Objective: Scroll a div containing plain text horizontally across a page indefinitely
Environment: Windows server running ASP.NET 4.0.
Language: C#/XHTML/Javascript
Tools Used: jQuery, jQueryTools, SmoothDivScroll

I have attempted to use a jQuery plugin known as SmoothDivScroll as well as jQueryTools to execute my objective, however, with my lack of client-side experience, I have had absolutely no success.

My webpage is available at http://paysonfirstassembly.com/ and the div that I am attempting to scroll has a class and ID of scrollingPanel.

I can provide sample code if it will help.

-Taylor

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如何视而不见 2024-11-09 21:46:55

这似乎满足您的需求: http://plugins.jquery.com/project/jqScroller

<style type="text/css">

  /* CSS for the scrollers */
  #scrollingPanel{
    position:relative;
    height:24px;
    width:500px;
    display:block;
    overflow:hidden;
    border:#CCCCCC 1px solid;
  }

  .scrollingtext{
      position:absolute;
      white-space:nowrap;
  }
</style>

$(document).ready(function() {

    //create a horizontal scroller
    $('#scrollingPanel').SetScroller({
        velocity: 80,
        direction: 'horizontal'
        //more tweaks on the source code of plugin page
    });


});

您的HTML 应如下所示:

<div id="scrollingPanel">
    <div class="scrollingtext">
        Making a Difference in People
    </div>
</div>

请参阅此页面源代码以了解更多功能和调整

This seems to fit your needs: http://plugins.jquery.com/project/jqScroller

<style type="text/css">

  /* CSS for the scrollers */
  #scrollingPanel{
    position:relative;
    height:24px;
    width:500px;
    display:block;
    overflow:hidden;
    border:#CCCCCC 1px solid;
  }

  .scrollingtext{
      position:absolute;
      white-space:nowrap;
  }
</style>

$(document).ready(function() {

    //create a horizontal scroller
    $('#scrollingPanel').SetScroller({
        velocity: 80,
        direction: 'horizontal'
        //more tweaks on the source code of plugin page
    });


});

your HTML should be like this:

<div id="scrollingPanel">
    <div class="scrollingtext">
        Making a Difference in People
    </div>
</div>

See this page source code for more functions and tweaks

兮子 2024-11-09 21:46:55

Remy Sharp 有一个很好的 jQuery Marquee 实现这里,其中 一些演示。这允许你做

<div class='marquee'>Scroll this</div>

然后

$('.marquee').marquee();

用他的插件包含。

Remy Sharp has a good jQuery Marquee implementation here with some demos. This allows you to do

<div class='marquee'>Scroll this</div>

and then

$('.marquee').marquee();

with his plug-in included.

无敌元气妹 2024-11-09 21:46:55

像这样将文本包裹在选框标签中

<div class="scrollingPanel">
    <marquee>Making a Difference in People</marquee>
</div>

尽管如此,我个人不推荐此解决方案。但它会像魅力一样对你的大学项目有用。它不需要任何外部脚本。

Wrap your text in marquee tag like this

<div class="scrollingPanel">
    <marquee>Making a Difference in People</marquee>
</div>

Though, I personally DO NOT RECOMMEND this solution. But it will work for your college project like charm. It doesn't need any external scripts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文