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

problem sa tooltipom u ajax-u

[es] :: Javascript i AJAX :: problem sa tooltipom u ajax-u

[ Pregleda: 1217 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

gogi100
Goran Ljubic

Član broj: 40722
Poruke: 1064
79.101.175.*



+3 Profil

icon problem sa tooltipom u ajax-u14.02.2009. u 02:14 - pre 185 meseci
na netu sam nasao ajax tooltip koji mi odgovara. podesio sam ga, radi u firefoxu,chrome,ali nikako u IE6. kako ga omoguciti? sta da radim?
kod je sledeci
Code:
var ajaxtooltip={
    fadeeffect: [true, 300], //enable Fade? [true/false, duration_milliseconds]
    useroffset: [10, 10], //additional x and y offset of tooltip from mouse cursor, respectively
    loadingHTML: '<div style="font-style:italic"><img src="ajaxload.gif" /> Fetching Tooltip...</div>',

    positiontip:function($tooltip, e){
        var docwidth=(window.innerWidth)? window.innerWidth-15 : ajaxtooltip.iebody.clientWidth-15
        var docheight=(window.innerHeight)? window.innerHeight-18 : ajaxtooltip.iebody.clientHeight-15
        var twidth=$tooltip.get(0).offsetWidth
        var theight=$tooltip.get(0).offsetHeight
        var tipx=e.pageX+this.useroffset[0]
        var tipy=e.pageY+this.useroffset[1]
        tipx=(e.clientX+twidth>docwidth)? tipx-twidth-(2*this.useroffset[0]) : tipx //account for right edge
        tipy=(e.clientY+theight>docheight)? tipy-theight-(2*this.useroffset[0]) : tipy //account for bottom edge
        $tooltip.css({left: tipx, top: tipy})
    },

    showtip:function($tooltip, e){
        if (this.fadeeffect[0])
            $tooltip.hide().fadeIn(this.fadeeffect[1])
        else
            $tooltip.show()
    },

    hidetip:function($tooltip, e){
        if (this.fadeeffect[0])
            $tooltip.fadeOut(this.fadeeffect[1])
        else
            $tooltip.hide()
    }

}

jQuery(document).ready(function(){
    ajaxtooltip.iebody=(document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    var tooltips=[] //array to contain references to all tooltip DIVs on the page
    $('*[@title^="ajax:"]').each(function(index){ //find all links with "title=ajax:" declaration
        this.titleurl=jQuery.trim(this.getAttribute('title').split(':')[1]) //get URL of external file
        this.titleposition=index+' pos' //remember this tooltip DIV's position relative to its peers
        tooltips.push($('<div class="ajaxtooltip"></div>').appendTo('body'))
        var $target=$(this)
        $target.removeAttr('title')
        $target.hover(
            function(e){ //onMouseover element
                var $tooltip=tooltips[parseInt(this.titleposition)]
                if (!$tooltip.get(0).loadsuccess){ //first time fetching Ajax content for this tooltip?
                    $tooltip.html(ajaxtooltip.loadingHTML).show()
                    $tooltip.load(this.titleurl, '', function(){
                        ajaxtooltip.positiontip($tooltip, e)
                        ajaxtooltip.showtip($tooltip, e)
                        $tooltip.get(0).loadsuccess=true
                    })

                }
                else{
                    ajaxtooltip.positiontip($tooltip, e)
                    ajaxtooltip.showtip($tooltip, e)
                }
            },
            function(e){ //onMouseout element
                var $tooltip=tooltips[parseInt(this.titleposition)]
                ajaxtooltip.hidetip($tooltip, e)        
            }
        )
        $target.bind("mousemove", function(e){
            var $tooltip=tooltips[parseInt(this.titleposition)]
            ajaxtooltip.positiontip($tooltip, e)
        })
    })
})


u HTML stranici sam ubacio sledece

Code:
<script type="text/javascript" src="jquery-1.2.2.pack.js"></script>

<style type="text/css">

.ajaxtooltip{
position: absolute; /*leave this alone*/
display: none; /*leave this alone*/
width: 300px;
left: 0; /*leave this alone*/
top: 0; /*leave this alone*/
background: lightyellow;
border: 2px solid gray;
border-width: 1px 2px 2px 1px;
padding: 5px;
}

</style>

<script type="text/javascript" src="ajaxtooltip.js">

/***********************************************
* Ajax Tooltip script- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/

</script>


i na stranici sam uneo

Code:
<img  name="Map" src="mesta/slika.jpg" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area title="ajax:mesta/strana1.htm" shape="poly" coords="58,127,44,121,36,119,36,109,38,103,42,92,47,88,62,75,64,85,68,94,72,102,66,116,63,123" href="#"   />
<area shape="poly" coords="82,35,72,50,65,65,65,78,67,88,70,94,75,103,78,112,82,108,87,102,92,94,97,94,105,94,113,93,119,93,123,90,129,87,136,86,146,84,151,82,148,76,147,68,147,61,147,56,137,55,130,49,116,45,106,41,98,38,90,38" href="#"   title="ajax:mesta/strana2.htm" />
</map>

Sta ubaciti kod da bi se tooltip pojavio i u IE-u kad odem na maticnu stranicu odakle sam skinuo tootltip IE ga otvara,a sa moje strane nece.
gde gresim?
hvala
 
Odgovor na temu

[es] :: Javascript i AJAX :: problem sa tooltipom u ajax-u

[ Pregleda: 1217 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

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