codingdir logo sitemap sitemap |
Home
PHP
C#
C++
ANDROID
JAVA
JAVASCRIPT
PYTHON

Resize parent element with dynamic content


By : , Category : javascript

Just make parent div width and height "auto" and then it will resize automatically when h1 resizes

ReLated :

Use div tag. Create a separate division of your content. Then you can customize all the things as much as you can.

You problem lays with

var id = $(".wall-post").attr("id");

With this line your searching for objects with the class "wall-post" and getting their ID's. Rather what you need to be doing is getting the object that was actually clicked.

Try using

var id = $(this).attr("id");

"this" relates to the object that that was actually clicked.

What I recommend doing though is

$(this).find(".post-comment").focus();

Using "this" you can then use find to search for elements (eg post-comment) and focus on them.

If you want items to resize depending on parent elements size you have to keep in mind that ontrols are implicitly inheriting parents stretching behavior when size in not set explicitly. So to fix your problem you need to remove setting Width and Height explicitly:

<Grid>
   <DataGrid AutoGenerateColumns="False" Name="dgEventViewerOptions" SelectionChanged="dgEventViewOptions_SelectionChanged" />
</Grid>

You would use constraints. Here is an example of how I did it with a scrollview. With a textview it is scrollable, and doesn't require you to set a content size, you simply put the content in it. If you want to control the viewable area of the uitextview, you will need to adjust it to what you see fit based on the amount of text you have, font and spacing you use.

    NSDictionary *viewsDic = @{
        @"image":image,
        @"text": text,
        @"lable":label,
        @"someview":someview,
        @"anotherview":anotherview};

    [someview addConstraints:
        [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[image(320)]|"
                                                options:0
                                                metrics:0
                                                  views:viewsDic]];
    [someview addConstraints:
        [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[image]|"
                                                options:0
                                                metrics:0
                                                  views:viewsDic]];
    [someview addConstraints:
        [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-14-[label]"
                                                        @"[text(<=200)]"
                                                options:0
                                                metrics:0
                                                  views:viewsDic]];
    [someview addConstraints:
        [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-22-[txtDollarAmountFront(==37)]"
                                                options:0
                                                metrics:0
                                                  views:viewsDic]];
    [someview addConstraints:
        [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-19-[label]"
                                                options:0
                                                metrics:0
Comments


Message :
Login to Add Your Comments .
How to disable registered OpenCL platforms on Windows?
Is Observable broken in Angular 2 Beta 3?
Cross-thread operation not valid when using Invoke
How to pass an IEnumerable or queryable list of properties from Controller to View
Finding numbers after a certain keyword using Python
Pocketsphinx recognizes random phrases in a silence
Passing non-thread-safe objects through thread-safe containers
React scroll nav
BizTalk WCF-BasicHttp Adapter does not allow Empty string for Service Certificate Props
Why property ''cause" of Exception is repeating forever?
Privacy Policy 2017 © codingdir.com All Rights Reserved .