EzDevInfo.com

position interview questions

Top position frequently asked interview questions

Dialog box not positions center screen

I have a jQuery dialog box that is meant to position in the middle of the screen. However, it seems slightly off-center vertically.

Here is the code:

$('#add_box').dialog({
    autoOpen: true,
    width: 300,
    modal: true,
    resizable: false,
    bgiframe:true
});

Any ideas why this won't center?


Source: (StackOverflow)

Retrieve the position (X,Y) of an HTML element

I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript.


Source: (StackOverflow)

Advertisements

slide right to left?

I would like to have a div go from collapsed to expanded (and vice versa), but do so from right to left. Most everything I see out there is always left to right.


Source: (StackOverflow)

css - position div to bottom of containing div

How can i position a div to the bottom of the containing div?

<style>
.outside {
    width: 200px;
    height: 200px;
    background-color: #EEE; /*to make it visible*/
}
.inside {
    position: absolute;
    bottom: 2px;
}
</style>
<div class="outside">
    <div class="inside">inside</div>
</div>

This code puts the text "inside" to the bottom of the page.


Source: (StackOverflow)

c# datatable insert column at position 0

does anyone know the best way to insert a column in a datatable at position 0?


Source: (StackOverflow)

Position element fixed vertically, absolute horizontally

Here's what I'm trying to accomplish:

I need a button which is positioned a certain distance from the right side of a div, and is always that same distance from the side of the div no matter the size of the viewport, but will scroll with the window.

So it is x pixels from the right side of the div at all times, but y pixels from the top of the view port at all times.

Is this possible?


Source: (StackOverflow)

How to set iPhone UI View z index?

I want to move one view on top of another, how can I know the z index of the view, and how to move on to top? Thank you.


Source: (StackOverflow)

Go: how to find out element position in slice?

Sorry, the question might look silly, but I can't find a standard way to find out an element position in slice.

I need something like that:

type intSlice []int

func (slice intSlice) pos(value int) int {
    for p, v := range slice {
        if (v == value) {
            return p
        }
    }
    return -1
}

UPD: fixed code to be more idiomatic :)


Source: (StackOverflow)

How do I get the coordinate position after using jQuery drag and drop?

How do I get the coordinate position after using jQuery drag and drop? I want to save the coordinate to a database, so that next time I visit, the item will be in that position. For example, x: 520px, y: 300px?

EDIT:

I am PHP and mysql programmer :)

Is there any tutorial out there?


Source: (StackOverflow)

Git alias with positional parameters

Basically I'm trying to alias:

git files 9fa3

...to execute the command:

git diff --name-status 9fa3^ 9fa3

but git doesn't appear to pass positional parameters to the alias command. I have tried:

[alias]
    files = "!git diff --name-status $1^ $1"
    files = "!git diff --name-status {1}^ {1}"

...and a few others but those didn't work.

The degenerate case would be:

$ git echo_reverse_these_params a b c d e
e d c b a

...how can I make this work?


Source: (StackOverflow)

Determine mouse position outside of events (using jQuery)?

I need to get a hold of the absolute mouse position / coordinates (X and Y) using (preferably) jQuery like in this tutorial but outside of any JavaScript event. Thank you.


Source: (StackOverflow)

Get position/offset of element relative to a parent container?

I'm used to working with jQuery. In my current project however I use zepto.js. Zepto doesn't provide a position() method like jQuery does. Zepto only comes with offset().

Any idea how I can retrieve the offset of a container relative to a parent with pure js or with Zepto?


Source: (StackOverflow)

bootstrap popover: advanced positioning

I'm trying to position a twitter-bootstrap popover for a trigger that sits on the far top-right corner of a 960px wide web page. Ideally, I'd position it on the bottom and move the arrow with CSS (so the arrow is on the top-right of the popover).

Unfortunately the 'placement':'bottom' positioning is not enough, since it will center it below the trigger.

I'm looking for solution that will place the popover statically below and on the left of the trigger. I read tons of questions but couldn't find any.

Hints?


Source: (StackOverflow)

css absolute position won't work with margin-left:auto margin-right: auto

Say you have the following css applied to a div tag

.divtagABS {
    position: absolute;
    margin-left: auto;  
    margin-right:auto;
 }

the margin-left and margin-right does not take effect

but if you have relative, it works fine i.e.

,divtagREL {
position: relative;
margin-left: auto;  
 margin-right:auto;
}

why is that? i just want to center an element

can someone explain why setting margins to auto in absolute position does not work?


Source: (StackOverflow)

How to get mouse position in jQuery without mouse-events?

I would like to get current mouse position but I don't want to use:

$(document).bind('mousemove',function(e){ 
        $("#log").text("e.pageX: " + e.pageX + ", e.pageY: " + e.pageY); 
}); 

because I just need to get the position and process the information


Source: (StackOverflow)