jQuery Plugins » element https://jqueryplugins.info jQuery plugins, tutorials and resources Mon, 17 Oct 2011 20:13:48 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 my jquery vertical center function doesn’t work with -moz-inline-stack block element https://jqueryplugins.info/2011/10/my-jquery-vertical-center-function-doesnt-work-with-moz-inline-stack-block-element/ https://jqueryplugins.info/2011/10/my-jquery-vertical-center-function-doesnt-work-with-moz-inline-stack-block-element/#comments Mon, 17 Oct 2011 07:13:55 +0000 Admin https://jqueryplugins.info/2011/10/my-jquery-vertical-center-function-doesnt-work-with-moz-inline-stack-block-element/ Post link: my jquery vertical center function doesn’t work with -moz-inline-stack block element

hi guys I was testing some divs with -moz-inline-stack I came across two problems: I found that if a parent div’s display is -moz-inline-stack its child’s height will automatically be...

]]>
Post link: my jquery vertical center function doesn’t work with -moz-inline-stack block element

hi guys I was testing some divs with -moz-inline-stack
I came across two problems:

  1. I found that if a parent div’s display is -moz-inline-stack
    its child’s height will automatically be set to 100% in firefox
    even I have specified its height in css

    • what’s -moz-inline-stack’s default setting ?

    • and do we still use -moz-inline-stack anymore
      from my research it seems like a fix for old firefox

  2. I wrote a jquery function that will vertically centre
    the child div which nested a img but firefox seems to ignore this function

    • I am not too sure why

here’s the code

html:

<body>
    <div id="box">

        <div id="img_box">
            <img src="images/logo.jpg">
        </div>

    </div>
</body>

css:

#box{

    display:inline-block;
    display:-moz-inline-stack;
    overflow:hidden;
    background:#999;
    height:50px;

}

#img_box{
    background:#CCC;
    height:20px;
}

script:

<script src="jquery-1.6.1.min.js"></script>
<script>

function centre_div(target_div,parent_div){

    var target_height= parseInt($  (target_div).css("height"));
    var parent_height= parseInt($  (parent_div).css("height"));
    var margin= (parent_height-target_height)/2+"px";
    String(margin);
    $  (target_div).css('marginTop',margin);

}

$  (document).ready(function(){

    centre_div("#img_box","#box");

});

</script>

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/my-jquery-vertical-center-function-doesnt-work-with-moz-inline-stack-block-element/feed/ 0
How to focus of tab from one element to another? https://jqueryplugins.info/2011/10/how-to-focus-of-tab-from-one-element-to-another/ https://jqueryplugins.info/2011/10/how-to-focus-of-tab-from-one-element-to-another/#comments Mon, 17 Oct 2011 05:14:29 +0000 Admin https://jqueryplugins.info/2011/10/how-to-focus-of-tab-from-one-element-to-another/ Post link: How to focus of tab from one element to another?

I have a form in witch following is one of the table <tr> <td>&nbsp;</td> <td valign="top"><nobr> Address Line 1 :</nobr></td> <td><input type="text" name="strLine1" class="textfield" id="strLine1" onFocus="nextfield ='strLine2';" /> <br /><span...

]]>
Post link: How to focus of tab from one element to another?

I have a form in witch following is one of the table

<tr>
   <td>&nbsp;</td>
   <td valign="top"><nobr> Address Line 1 :</nobr></td>
   <td><input type="text" name="strLine1" class="textfield" id="strLine1" onFocus="nextfield ='strLine2';" />
<br /><span id="strLine1Info" ></span>
   </td>
   <td>&nbsp;</td>
   <td align="left" valign="top"><nobr>Address Line 1 :</nobr></td>
   <td><input type="text" name="hstrLine1" class="textfield" id="hstrLine1" onFocus="nextfield ='hstrLine2';" />
    <br /><span id="hstrLine1Info" ></span>
   </td>
   <td>&nbsp;</td>
 </tr>
 <tr>
   <td>&nbsp;</td>
   <td valign="top"><nobr>Address Line 2 :</nobr></td>
   <td><input type="text" name="strLine2" class="textfield" id="strLine2" onFocus="nextfield ='city';" />
    <br /><span id="strLine2Info" ></span>
   </td>
   <td>&nbsp;</td>
   <td align="left" valign="top"><nobr>Address Line 2 :</nobr></td>
   <td><input type="text" name="hstrLine2" class="textfield" id="hstrLine2" onFocus="nextfield ='hcity';" />
    <br /><span id="hstrLine2Info" ></span>
   </td>
    <td>&nbsp;</td>
 </tr>
 <tr>
     <td>&nbsp;</td>
     <td valign="top"> State :</td>
     <td>
    <input type="text" name="state" class="textfield" value="Secrete" id="state"  onFocus="nextfield ='Zip';" disabled />
    <br /><span id="stateInfo" ></span>                         </td>
     <td>&nbsp;</td>
     <td valign="top"> State :</td>
     <td>
<input type="text" name="hstate" class="textfield" value="Secrete" id="hstate" onFocus="nextfield ='hZip';" disabled />
<br /><span id="hstateInfo" ></span>                            </td>
     <td>&nbsp;</td>
   </tr>

I want to move the tab (keyboard tab) from

Address Line 1 -> Address Line 2 -> State -> (second column)Address Line 1 -> (second column)Address Line 2 -> (second column)State

Here i wanted to do in jquery.
please suggest.
thanks

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/how-to-focus-of-tab-from-one-element-to-another/feed/ 0
change element height if it overfows https://jqueryplugins.info/2011/10/change-element-height-if-it-overfows/ https://jqueryplugins.info/2011/10/change-element-height-if-it-overfows/#comments Mon, 17 Oct 2011 02:13:40 +0000 Admin https://jqueryplugins.info/2011/10/change-element-height-if-it-overfows/ Post link: change element height if it overfows

I am using jquery and I have an accordion widget. I place content inside each container dynamically. I will like the accordion to grow (height increase) as I place new...

]]>
Post link: change element height if it overfows

I am using jquery and I have an accordion widget. I place content inside each container dynamically. I will like the accordion to grow (height increase) as I place new content inside a new control. my accordion control looks like:

enter image description here

I initialize my projects accordion widget as:

$  ("#accordion").accordion({
                autoHeight: false,
                navigation: true,
                collapsible: true,
                fillSpace: true

            });

as I place html inside that accordion with Ajax dynamically you can see that the elements start overflowing. I don’t want to see the scroll bars.

So I was thinking of dong something like:

somehow with JavaScript see if an element on the dom is overflowing (has the scroll bar)

if it does then increase it's height by 10 px until it does not overflow.

I know I can set a fix height but I don’t know how much html content I will be placing in each accordion in advance. What do you guys suggest on how to deal with this overflowing issue?

EDIT

It will be nice if I could resolve this with css since I construct the accordion widget dynamically.

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/change-element-height-if-it-overfows/feed/ 0
How to replace link with list element and then add new link in IE7/8 with jQuery? https://jqueryplugins.info/2011/10/how-to-replace-link-with-list-element-and-then-add-new-link-in-ie78-with-jquery/ https://jqueryplugins.info/2011/10/how-to-replace-link-with-list-element-and-then-add-new-link-in-ie78-with-jquery/#comments Mon, 17 Oct 2011 01:14:36 +0000 Admin https://jqueryplugins.info/2011/10/how-to-replace-link-with-list-element-and-then-add-new-link-in-ie78-with-jquery/ Post link: How to replace link with list element and then add new link in IE7/8 with jQuery?

I can’t control how the HTML is generated and need to put a string of links into a list and then add new links for each item. I have simplified...

]]>
Post link: How to replace link with list element and then add new link in IE7/8 with jQuery?

I can’t control how the HTML is generated and need to put a string of links into a list and then add new links for each item.

I have simplified the code at http://jsfiddle.net/jhASu/ and it works in Chrome/Firefox and IE9 but not in IE 7 and 8 (no new links are generated). What could be the cause of this?

Thanks in advance.

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/how-to-replace-link-with-list-element-and-then-add-new-link-in-ie78-with-jquery/feed/ 0
how to get a custom data value from a highlighted class element using jquery? https://jqueryplugins.info/2011/10/how-to-get-a-custom-data-value-from-a-highlighted-class-element-using-jquery/ https://jqueryplugins.info/2011/10/how-to-get-a-custom-data-value-from-a-highlighted-class-element-using-jquery/#comments Sun, 16 Oct 2011 12:13:26 +0000 Admin https://jqueryplugins.info/2011/10/how-to-get-a-custom-data-value-from-a-highlighted-class-element-using-jquery/ Post link: how to get a custom data value from a highlighted class element using jquery?

how to get a custom data value from a highlighted class element using jquery? this does not work… $ (“#list li.highlight”).attr(“data-keyValue”); <— is this possible with another syntax for this...

]]>
Post link: how to get a custom data value from a highlighted class element using jquery?

how to get a custom data value from a highlighted class element using jquery?
this does not work…

$ (“#list li.highlight”).attr(“data-keyValue”); <— is this possible with another syntax for this to work?

$ (‘#list’).append(” + list_dataValue + ‘

‘);

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/how-to-get-a-custom-data-value-from-a-highlighted-class-element-using-jquery/feed/ 0
element inside a colorbox with an action https://jqueryplugins.info/2011/10/element-inside-a-colorbox-with-an-action/ https://jqueryplugins.info/2011/10/element-inside-a-colorbox-with-an-action/#comments Sat, 15 Oct 2011 08:13:33 +0000 Admin https://jqueryplugins.info/2011/10/element-inside-a-colorbox-with-an-action/ Post link: element inside a colorbox with an action

How can i improve my colorbox element with an action. Want to call a new colorbox after cliking in an element on my existing colorbox. Thanks in advnc newest questions...

]]>
Post link: element inside a colorbox with an action

How can i improve my colorbox element with an action.
Want to call a new colorbox after cliking in an element on my existing colorbox.

Thanks in advnc

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/element-inside-a-colorbox-with-an-action/feed/ 0
add event to corresponding element in tabs within accordion – jquery and razor https://jqueryplugins.info/2011/10/add-event-to-corresponding-element-in-tabs-within-accordion-jquery-and-razor/ https://jqueryplugins.info/2011/10/add-event-to-corresponding-element-in-tabs-within-accordion-jquery-and-razor/#comments Thu, 13 Oct 2011 18:13:29 +0000 Admin https://jqueryplugins.info/2011/10/add-event-to-corresponding-element-in-tabs-within-accordion-jquery-and-razor/ Post link: add event to corresponding element in tabs within accordion – jquery and razor

I have jquery accordion which i am generating dynamically using C# razor. Within this accordion there are tabs. Every accordion level has two tabs initially. Search and New. I want...

]]>
Post link: add event to corresponding element in tabs within accordion – jquery and razor

I have jquery accordion which i am generating dynamically using C# razor. Within this accordion there are tabs. Every accordion level has two tabs initially. Search and New. I want to get the behavior that when user clicks particular level accordion new it will add one more tab into it. I am putting all the code i have here.

//Dynamic creation of accordion and tabs within it with razor
  <div class="accordion">
        @foreach (var service in Model)
        {
            <h3>@service.WorkflowName</h3>
            <div id="searchtab" class="searchtab">
                <ul class="tab ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
                    <li><a href="#tab_1">Search-1</a><span class="ui-icon ui-icon-close"></span></li>
                </ul>
                <ul class="tabnew">
                    <li><a href="#" id="@string.Concat("NewSearch_",@service.SubCategory)" >New</a></li>
                </ul>
                <div class="cl">
                </div>

            </div>
        }
    </div>

//Settting accordian properties
    $  (".accordion").accordion({
        collapsible: true,
        icons: { header: "close", headerSelected: "open" },
        active: 1
    });

$  tabs = $  ("#searchtab").tabs({
        tabTemplate: "<li><a href='#{href}'>#{label}</a><span class='ui-icon ui-icon-close'></span></li>",
        add: function (event, ui) {
            $  .ajax({
                url: "@Url.Action("SearchHotel", "Service")",
                type: "get",
                dataType: "html",
                success: function (data) {
                    $  (ui.panel).append(data);
                     $  ("#txtDeparture,#txtArrival").datepicker();

                     if(isSetup)
                     {
                        var city=$  ("#hdnSourceCity").val();
                        if(city=='')
                        {
                            city=$  ("#hdnDestCity").val();
                        }
                        $  ("#SearchString").val(city);
                        $  ("#txtArrival").val($  ("#hdnStartDate").val());
                        $  ("#txtDeparture").val($  ("#hdnEndDate").val());
                     }
                },
                error: function (a, b) {
                    alert(b + "Not able to create search content");
                }
            });
        }
    });

$  ("ul.tabnew li a:contains(New)").live("click", function () {
        $  tabs.tabs("add", "#tabs_" + tabcnt, "Search-" + (tabcnt));
        $  tabs.tabs("option", "selected", $  tabs.tabs("length") - 1);

        tabcnt++;
        return false;
    });

I am trying to achieve but any new click only adds tabs to first level accordion only why? I want
to use $ .each or something but don’t know how to use that.

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/add-event-to-corresponding-element-in-tabs-within-accordion-jquery-and-razor/feed/ 0
Juqery UI Dialog get parent page element value https://jqueryplugins.info/2011/10/juqery-ui-dialog-get-parent-page-element-value/ https://jqueryplugins.info/2011/10/juqery-ui-dialog-get-parent-page-element-value/#comments Wed, 12 Oct 2011 22:15:02 +0000 Admin https://jqueryplugins.info/2011/10/juqery-ui-dialog-get-parent-page-element-value/ Post link: Juqery UI Dialog get parent page element value

Please see this example http://jqueryui.com/demos/dialog/#modal-form When click “Create new user”, can I get parent page’s element val (like input value) in the dialog? I tired to get value in dialog...

]]>
Post link: Juqery UI Dialog get parent page element value

Please see this example http://jqueryui.com/demos/dialog/#modal-form

When click “Create new user”, can I get parent page’s element val (like input value) in the dialog?

I tired to get value in dialog but always get not defined result.

 fvalue = $  ( "#iv" ).val(); // #iv is a input box in parent page.

Thanks!

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/juqery-ui-dialog-get-parent-page-element-value/feed/ 0
Modifying Element with jQuery using Event https://jqueryplugins.info/2011/10/modifying-element-with-jquery-using-event/ https://jqueryplugins.info/2011/10/modifying-element-with-jquery-using-event/#comments Wed, 12 Oct 2011 19:15:40 +0000 Admin https://jqueryplugins.info/2011/10/modifying-element-with-jquery-using-event/ Post link: Modifying Element with jQuery using Event

I have a table set up such that each row has a checkbox as the first item in the row (think Gmail’s inbox). The <tr> of that row has a...

]]>
Post link: Modifying Element with jQuery using Event

I have a table set up such that each row has a checkbox as the first item in the row (think Gmail’s inbox). The <tr> of that row has a hover and click event handler bound to it.

What I want to happen is, when the user clicks on the checkbox, the checkbox becomes checked and that’s all. When the user clicks anywhere else in the row, it should do something else. I am trying to achieve this by looking at the event.target of the event being passed and seeing if that’s a checkbox or not. However, with my current implementation, when the user clicks on the checkbox, nothing happens and when they click anywhere else in the row, it behaves how I expect.

What am I doing wrong with regards to the checkbox?

Here is my code:

$  ('.navTable > tbody > tr').hover(function() {

if (!$  (this).children('td').hasClass('spacer') && !$  (this).children('th').length > 0)
    $  (this).css({background : "#EFEFEF", border : "1px solid #CCC"});
},function() {
    $  (this).css({background : "", border : ""});
}).click(function(e) {
    console.log(e);
    if(e.target.attributes[0].nodeValue == "checkbox") {
        // Check the checkbox
        $  ("#"+e.target.id).attr('checked', 'checked');
    } else {
        // Do something else
    }
    return false;
});

Thank you for any help you might provide.

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/modifying-element-with-jquery-using-event/feed/ 0
Select element from json dynamically https://jqueryplugins.info/2011/10/select-element-from-json-dynamically/ https://jqueryplugins.info/2011/10/select-element-from-json-dynamically/#comments Mon, 10 Oct 2011 17:23:05 +0000 Admin https://jqueryplugins.info/2011/10/select-element-from-json-dynamically/ Post link: Select element from json dynamically

I have a an associative array in php that i parse to get json from it (json_encode) then i store the result in a javascript var var myArray = <?php...

]]>
Post link: Select element from json dynamically

I have a an associative array in php that i parse to get json from it (json_encode) then i store the result in a javascript var

var myArray = <?php print json_encode($  phpArray); ?>;

Now whene the user hit a button i should choose another element from the array dynamically, for example, i chose a random first element :

var an_element = myArray.a2.link;

(‘a2′ is an array in the main array and ‘link’ is an element in this array ).

So now whene the user hit my button, i want to choose a random other array id (for example a5, a9, etc.)
I tried this :

var randomnumber=Math.floor(Math.random()*101); // choose random number
var newRandomArrayID= "a"+randomnumber;
an_element = myArray.newRandomArrayID.link;

It doesn’t works, it says myArray.newRandomArrayID is undefined.
Anyone can help?
Thank you

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/select-element-from-json-dynamically/feed/ 0