Skip to content Skip to sidebar Skip to footer

Continues Marquee In Asp.net

I'm developing news website in asp.net, and I want to make news bar that move news from right to left , I have did it with Marquee tag but the problem is I want it to repeat its co

Solution 1:

If you must have marquee functionality then try using a jQuery plugin such as simplyScroll v1 which supports continuous scrolling (ie. it seamlessly wraps around). Note, however, that marquees are considered bad for usability and accessibility in the same way the old <blink> tag was - see http://en.wikipedia.org/wiki/Marquee_element#Usability_problems


Solution 2:


I believe this will help you:

 <script type="text/javascript" language="javascript">
    function objWidth(obj) {
        if (obj.offsetWidth) return obj.offsetWidth;
        if (obj.clip) return obj.clip.width;
        return 0;
    }
    var mqr = [];

    function mq(id) {
        this.mqo = document.getElementById(id);
        var wid = objWidth(this.mqo.getElementsByTagName('span')[0]) + 5;
        var fulwid = objWidth(this.mqo);
        var txt = this.mqo.getElementsByTagName('span')[0].innerHTML;
        this.mqo.innerHTML = '';
        var heit = this.mqo.style.height;
        this.mqo.onmouseout = function () {
            mqRotate(mqr);
        };
        this.mqo.onmouseover = function () {
            clearTimeout(mqr[0].TO);
        };
        this.mqo.ary = [];
        var maxw = Math.ceil(fulwid / wid) + 1;
        for (var i = 0; i < maxw; i++) {
            this.mqo.ary[i] = document.createElement('div');
            this.mqo.ary[i].innerHTML = txt;
            this.mqo.ary[i].style.position = 'absolute';
            this.mqo.ary[i].style.left = (wid * i) + 'px';
            this.mqo.ary[i].style.width = wid + 'px';
            this.mqo.ary[i].style.height = heit;
            this.mqo.appendChild(this.mqo.ary[i]);
        }
        mqr.push(this.mqo);
    }

    function mqRotate(mqr) {
        if (!mqr) return;
        for (var j = mqr.length - 1; j > -1; j--) {
            maxa = mqr[j].ary.length;
            for (var i = 0; i < maxa; i++) {
                var x = mqr[j].ary[i].style;
                x.left = (parseInt(x.left, 10) - 1) + 'px';
            }
            var y = mqr[j].ary[0].style;
            if (parseInt(y.left, 10) + parseInt(y.width, 10) < 0) {
                var z = mqr[j].ary.shift();
                z.style.left = (parseInt(z.style.left) + parseInt(z.style.width) * maxa) + 'px';
                mqr[j].ary.push(z);
            }
        }
        mqr[0].TO = setTimeout('mqRotate(mqr)', 10);
    }
 </script>

 <script type="text/javascript">
    function start() {
        new mq('m1');
        mqRotate(mqr);
    }

    window.onload = start;
 </script>

 <div id="m1" class="marquee">
    <span>Example for Continous Text</span>
 </div>

Solution 3:

I believe this site has implementation that meets your requirement http://www.givainc.com/labs/marquee_example.htm

SO link


Solution 4:

If you want a news scroller you can try this plugin for jQuery liScroll, I don't know if you want to refresh the news without page reload?

Link: http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html


Solution 5:

<asp:Literal ID="Literal1" runat="server"></asp:Literal>

Then you can give value for the literal.

protected void Page_Load(object sender, EventArgs e)
{
    string str = "get data from database";
    string text = "<MARQUEE>" + str + "</MARQUEE>";
    Literal1.Text = text;
}

I think this website is useful. http://www.dynamicdrive.com/dynamicindex2/

http://www.htmlcodetutorial.com/_MARQUEE.html


Post a Comment for "Continues Marquee In Asp.net"