Tuesday, February 14, 2017

Ajax Response

function showState(){
            if(xhr.readyState==4){
                if(xhr.status==200){
                    var outMsg = xhr.responseText;
                }else{
                    var outMsg = "<p>The current state is " + xhr.readyState + " and the status is " + xhr.status + "</p>";
                }
            }
            document.getElementById("updateArea").innerHTML = outMsg;
        }

Ajax Request

window.onload = makeRequest;
        var xhr = false;
       
        function makeRequest(){
            if(window.XMLHttpRequest){
                xhr = new XMLHttpRequest;
            }
            else {
                if(window.ActiveXObject){
                    try{
                        xhr = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch(e){}
                }
            }
           
            if(xhr){
                xhr.onreadystatechange = showState;
                xhr.open("GET", "states.xml", true);
                xhr.send(null);
            }
            else{
                document.getElementById("updateArea").innerHTML = "Sorry";
            }
        }

Tuesday, December 10, 2013

For Tree Menu (onclick open a ul element.)

$("ul li").find('ul').hide();
$("ul li").click(function(){
    if($(this).find('ul').is(':hidden')){
        $("ul li").find('ul').slideUp();
        $(this).find('ul').slideDown();
    }
});


For Tree Menu (onclick open a ul element.)

Friday, October 11, 2013

Tooltip for everything..

Here is the resolution of every tooltip issue..
Here I got the new tooltip plugin which is easier to use and handle easier with different styles.. Poshytip Tooltip

Download

$('#demo-tip-violet').poshytip({
 className: 'tip-violet',// Class
 bgImageFrameSize: 9,
 offsetX: 0,
 offsetY: 20,
        showTimeout: 1,
 alignTo: 'target',
 alignX: 'center', //inner-left, left, right, top, bottom,
        alignY: 'center', //inner-left, left, right, top, bottom 
        allowTipHover: false,
        fade: false,
 slide: false,
        showOn: 'focus',
        followCursor: true, 
        content: 'Hey, there! This is a tooltip.',
 
 });
 
 

content String, DOM element, Function, jQuery

Possible Values: '[title]', 'string', element, function(updateCallback){...}, jQuery
Content to display.

className String

Class for the tips.

bgImageFrameSize Number

Size in pixels for the background-image (if set in CSS) frame around the inner content of the tip.

showTimeout Number

Timeout before showing the tip (in milliseconds 1000 == 1 second).

hideTimeout Number

Timeout before hiding the tip.

timeOnScreen Number

How long the tip will be displayed before automatically hiding.

showOn String

Possible Values: 'hover', 'focus', 'none'

Handler for showing the tip. Use 'none' if you would like to trigger the tooltip just manually (i.e. by calling the 'show' and 'hide' methods).

liveEvents Boolean

Use live events.

Note that the API methods (except 'destroy') won't work reliably when live events are used. They will only work for the elements for which the tooltip has been initialized (i.e. shown at least once). Live events are supported in jQuery 1.4.2+.

alignTo String

Possible Values: 'cursor', 'target'
Align/position the tip relative to

alignX String

Possible Values: 'right', 'center', 'left', 'inner-left', 'inner-right'
Horizontal alignment for the tip relative to the mouse cursor or the target element - values 'inner-*' matter if alignTo:'target'

alignY String

Possible Values: 'bottom', 'center', 'top', 'inner-bottom', 'inner-top'
Vertical alignment for the tip relative to the mouse cursor or the target element - values 'inner-*' matter if alignTo:'target'

offsetX Number

Offset X pixels from the default position - doesn't matter if alignX:'center'

offsetY Number

Offset Y pixels from the default position - doesn't matter if alignY:'center'

keepInViewport Boolean

Reposition the tooltip if needed to make sure it always appears inside the viewport.

allowTipHover Boolean

Allow hovering the tip without hiding it onmouseout of the target - matters only if showOn:'hover'

followCursor Boolean

If the tip should follow the cursor - matters only if showOn:'hover' and alignTo:'cursor'

fade Boolean

Use fade animation.

slide Boolean

Use slide animation.

slideOffset Number

Slide animation offset.

showAniDuration Number

Show animation duration.

hideAniDuration Number

Hide animation duration.

refreshAniDuration Number

Animation duration when updating the tooltip asynchronously. 

Friday, February 15, 2013

100%

If you gave 100% you will never lose 100 sure..