Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

JQuery Live Poruke

[es] :: Javascript i AJAX :: JQuery Live Poruke

[ Pregleda: 2371 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

balkan7

Član broj: 119255
Poruke: 82
88.85.105.*



Profil

icon JQuery Live Poruke19.04.2009. u 18:48 - pre 182 meseci
Koristim message ticker za prikazivanja na poruke, dali mogu pozvati poruke bez da koristim refreshu na sajtu sa jquery ili ajaxom ?

ovoj je deo koda koji prikazuje poruke kao slideshow, ali za nove poruke korisnik mora da refreshuje sajt za da i vidi, tako da treba mi pomoc bez refresha da prikazuje nove poruke iz datebaze.
Code:
<script type='text/javascript' src='jquery.js'></script>
    <script type='text/javascript'>
$(document).ready(
        function() {
            $('#poruke').Messages();
            $('#poruke').show('fast');

        });
    </script>
 
Odgovor na temu

Nikola Poša
Backend (PHP) developer
Beograd

Član broj: 173839
Poruke: 1616
*.adsl-a-1.sezampro.yu.



+33 Profil

icon Re: JQuery Live Poruke19.04.2009. u 18:57 - pre 182 meseci
A kako treba da se menjaju poruke, nakon nekog vremena, ili možda na neki događaj? Šta tačno radi ta f-ja Messages()? Pošalji još malo koda...
 
Odgovor na temu

balkan7

Član broj: 119255
Poruke: 82
88.85.105.*



Profil

icon Re: JQuery Live Poruke19.04.2009. u 19:08 - pre 182 meseci
evo ti kod iz jquery.js
Code:

 
(function($) {
$.fn.Messages = $.fn.poruke = function(delay)
{
    delay = delay || 2000;
    initTicker = function(el)
    {
        stopTicker(el);
        el.items = $("li", el);
        // hide all items (except first one)
        el.items.not(":eq(0)").hide().end();
        // current item
        el.currentitem = 0;
        startTicker(el);
    };
    startTicker = function(el)
    {
        el.tickfn = setInterval(function() { doTick(el) }, delay)
    };
    stopTicker = function(el)
    {
        clearInterval(el.tickfn);
    };
    pauseTicker = function(el)
    {
        el.pause = true;
    };
    resumeTicker = function(el)
    {
        el.pause = false;
    };
    doTick = function(el)
    {
        // don't run if paused
        if(el.pause) return;
        // pause until animation has finished
        el.pause = true;
        // hide current item
        $(el.items[el.currentitem]).fadeOut("slow",
            function()
            {
                $(this).hide();
                // move to next item and show
                el.currentitem = ++el.currentitem % (el.items.size());
                $(el.items[el.currentitem]).fadeIn("slow",
                    function()
                    {
                        el.pause = false;
                    }
                );
            }
        );
    };
    this.each(
        function()
        {
            if(this.nodeName.toLowerCase()!= "ul") return;
            initTicker(this);
        }
    )
    .addClass("poruke")
    .hover(
        function()
        {
            // pause if hovered over
            pauseTicker(this);
        },
        function()
        {
            // resume when not hovered over
            resumeTicker(this);
        }
    );
    return this;
};

})(jQuery);
 
Odgovor na temu

[es] :: Javascript i AJAX :: JQuery Live Poruke

[ Pregleda: 2371 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.