w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Removing elements that have no attributes, child elements, or text during transform
This should do the job: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:output indent="yes" method="xml" omit-xml-declaration="yes"/> <xsl:strip-space elements="*"/> <!-- Elements/attributes to remove. Note that comments are not elements or attributes. Since there is no template to match comments they are automatically ignored. --> <xsl:template match="@*[normalize-space()='']|info|@file_line_nr|@file_name"/> <!-- Match any attribute --> <xsl:template match="@*"> <xsl:copy> <xsl:apply-templates select="@*"/> </xsl:copy> </xsl:template> <!-- Match any element --> &l

Categories : Xml

Angularjs: custom grid component, dynamically add
elements
An easier approach may be to solve the problem with standard angular directives and css. For instance, if you float your cells and clear: left on those cells that start a new row, you can use ng-repeat and ng-class to accomplish this. I created an example at: http://jsbin.com/idukaz/1 The html looks like this. Note I'm using ng-class to apply the class that formats the cell that needs to start a new row depending on the result of calling the custom columnEnd function. columnBreak is a scope variable for the number of columns you want. $index is a variable generated by ng-repeat: <div class="table"> <div class="label" ng-class="{'new-row': startNewRow($index, columnBreak) }" ng-repeat="item in items">{{ item.name }} ({{ $index + 1 }})</div> </d

Categories : Angularjs

In Firefox SPAN elements cannot be dynamically added to elements with -column-width values
Solved it. As I suspected, its a matter of forcing Firefox to redraw elements. The problem is fixed after adding the following line to the addSpan( ) function. document.getElementById("content").innerHTML = document.getElementById("content").innerHTML;

Categories : HTML

Dynamically adding elements to jQuery Mobile , when these elements are retrieved Asynchronously?
Try to populate your list where you're building your albums arrays. var myList = $("ul"); // better save this in a var for (i=0; i<response.data.length; i++) { myList.append('<li><img src="' + response.data[i].cover_photo + '" /><h2>' + response.data[i].name + '</h2></li>').listview('refresh'); } Also, it seems you won't need these data arrays anymore unless you plan to do some additional things with it.

Categories : Jquery

Relative position in one div for more elements
You should make the wrapping divs a relative position so the absolute position will apply on inner elements: position: relative; jsFiddle Demo Note that you can't give a table-cell a relative position for it's not standardized and will work unexpectedly. For further reading: position - CSS | MDN Learn CSS Positioning in Ten Steps

Categories : HTML

Using CSS to transform list elements on hover
Is your li set as a block element? This works: http://jsfiddle.net/dQNFF/1/ I added this CSS: li { display: block; width: 100px; height: 20px; }

Categories : HTML

jQuery UI position relative to two elements
Your requirements are very specific to this unique situation. I don't have a ready-to-use solution for you, but a suggestion how to tackle the problem. My suggestion is to implement a custom jQuery function (for example position2) that will calculate the position according to your desired options. Since jQuery UI code is available for everyone to browse through (and grab), you can look at the position function implementation and copy most of the code to your new jQuery function. Important! You can't use same property name in the options object. The usage of this new function will look something like that: $("#element").position2({ my: "right top", atX: "right", ofX: "#rightMostItem", atY: "top", ofY: "#topMostItem" }); I know that this solution is not the easies

Categories : Javascript

Relative order of elements in list
This can be written as a list comprehension like this: lst = [1, 5, 4] s = sorted(lst) [s.index(x) for x in lst] => [0, 2, 1] And here's another test, using @frb's example: lst = [10, 2, 3, 9] s = sorted(lst) [s.index(x) for x in lst] => [3, 0, 1, 2]

Categories : Python

Applying scale transform to all elements in a table row
What about replacing .events-row:hover{background-color:white;transform:scale(1.5);} .content-cardnumber:hover{text-shadow:none;transform:inherit;} .content-readername:hover{text-shadow:none;transform:inherit;} .content-origintime:hover{text-shadow:none;transform:inherit;} .content-eventcode:hover{text-shadow:none;transform:inherit;} with this? .events-row:hover > td {background-color:white;transform:scale(1.5);text-shadow:none;}

Categories : HTML

css 3D transform elements disappear when perpendicular to viewer
I don't know if this solution applies to your case, due to the lack of details in your questions. But, in a general way, you can do this adding a border to the element you are rotating. There is an example: http://jsfiddle.net/4L8Ht/1/. In this case, I've added a blue border (same color of the rotated div). HTML: <div class="container"> <div class="rotateY r45deg"></div> </div> <div class="container"> <div class="rotateY r90deg"></div> </div> CSS: .container { width: 200px; height: 200px; margin: 50px; border: 1px solid #ccc; -webkit-perspective: 400; } .rotateY { width: 100%; height: 100%; background-color: #00f; border: 1px solid #00f; } .r45deg { -webkit-transform: rotateY(45deg); } .r9

Categories : HTML

How to force elements to have the same relative position in any screen?
It's quite simple. To have an element always appear in the centre, add to its css margin: 0 auto; As to the footer, first make a background div (with your image set as background) with width: 100%; And inside of it put a div with again: margin: 0 auto; And then put all these divs and images in the main container with position: absolute; bottom: 0px; From my experience, it is always better to use margins, paddings and fixed widths than relative or fixed positioning when working on a layout.

Categories : CSS

c# Relative position of elements in Windows Form
If you want two have two splitter panels of the same size set splitContainer1.SplitterDistance = (splitContainer1.Width - splitContainer1.SplitterWidth) / 2; Then set splitContainer1.IsSplitterFixed = true; You can set these two properties manually at design time. The user will then not be able to resize the panels and the panels will automatically resize to be of same size. Consider using a TableLayoutPanel instead. If further, the two sides should look the same, place your controls on a UserControl and place two instances of them into the two panels with a docked property set to Fill.

Categories : C#

html absolute elements in relative positioned div tag
You can't have the children set to position : absolute and expect them to resize their parent. That is fundamentally against what position : absolute does. If you want .postcell to be dynamically sized, all you'll have to do is remove the position : absolute line from its children. If you have reasons for why you can't do that, then the alternative is to write js that will set the height of each postcell to the height of it's children. jQuery code example: $(".postcell").each( function() { var height = $(this).children("#postspantitle").height() + $(this).children(".postptextdiv").height(); $(this).css("height", height + "px"); });

Categories : HTML

Laying things out relative to other elements (not RelativeLayout)
One approach to do this is to use android:layout_weight parameter in a linear layout. For example to have one element twice as big as the second one you can do: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:background="#FF0000" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="2" /> <LinearLayout android:background="#00FF00" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1" /> </LinearLayout> A bit more on this can be found in the ar

Categories : C#

nextAll selector, transform elements after clicked element
You can do this by selecting all the g elements, shifting them if the respective index is larger than the one of the bar you clicked on, and selecting all the rect elements and adjusting the width depending on whether the index is the one you clicked on. Updated jsfiddle here, relevant code below. Note that I assigned the class "bar" to the relevant g elements to be able to distinguish them from the others. nodes_enter.on('click', function(d, i) { d3.selectAll("g.bar") .attr('transform', function (e, j) { return 'translate(' + (j * 30 + (j > i ? 20 : 0)) + ',0)'; }); d3.selectAll("g.bar > rect") .attr("width", function(e, j) { return j == i ? 40 : 20; }); });

Categories : D3 Js

css transform doesn't work on css generated content for ::after, ::before elements
I got a bit curious about this myself, so I looked a bit further into it. Turns out, it does work. After looking at the test case: pseudo-transition.html I noticed the pseudo element had a style of: display: block. Changing your fiddle to use display: inline-block and voila! Fiddle And with an onLoad transition: Transition Fiddle New Style: a:after { display: inline-block; content: ' ⇧'; -webkit-transform: rotate(180deg); }

Categories : CSS

AngularJS directive - setting order for multiple directive elements (not priority for directives, but priority for the elements)
OK, here's my solution, although it's more a template. Fiddle (check the console log to see the result) I've wrapped the foo directive in a fooParent directive, like so: <div foo-parent> <div foo run="3"></div> <div foo run="1"></div> <div foo run="2"></div> </div> The fooParent directive exists pretty much to do three things: Expose a function to foo items so they can be added to a general list Maintain a list of foos, which will be sorted during post-linking Process each foo in the run order specified. It looks like this: app.directive('fooParent', function() { var foos = []; return { restrict: 'A', controller: ['$scope', '$element', '$attrs', '$transclude', function($scope, $element, $attrs, $t

Categories : Javascript

Why position: relative; places background elements their existent on front?
Using position:relative or position:absolute or position:fixed allows you to also use a z-index value to determine the order of stacking. if you set z-index:-1 on the h2 it should push it back behind the other elements. Alternatively you could set position:relative on the other element and set a higher z-index on that.

Categories : CSS

How to implement drag to change order of relative positioned elements?
It's not entirely clear how you want the draggable to behave, because your image suggests one thing, while your fiddle works differently (the one with absolute elements that you said it works). I`ll assume here you want to be able to drag them around the document like in the image. There are some differences between relative and absolute positioned elements. Both depend on their offsetParent (not necessarily parentNode), however on relative elements the top/left offset is always 0 (or the distance of the element relative to itself), unless you specify a different value. On absolute elements the left/top offset is the distance of the element relative to the offsetParent upper/left edge. So because all your SPANs start at left:0,top:0 offset (if we don't count margin etc.), you need to tak

Categories : Javascript

xsltproc transform to html removes close tags of empty elements
I figured it out. <xsl:output method="html" version="4.0" /> The non closed tags are actually valid html, but not xhtml. So this is working as expected.

Categories : Xml

Transform source file and sort elements based on class using a single XSLT
You need to do the xsl:perform-sort on a sequence. I modified your XSLT slightly by removing the template that matches / and modifying the template that matches ol. (And added xsl:strip-space for nicer looking output. You might want to remove it if your input has important white space.) XML Input (added some HD to a few li) <html> <head> <title></title> </head> <body> <!-- This is my first comment --> <ol> <li>3 Song 1</li> <li>4 Song 2</li> <li>5 Song 3 HD</li> <li>7 Song 4</li> <li>8 Song 5</li> <li>10 Song 6 HD</li> <li>14 Song 7</li>

Categories : HTML

Can I prevent jQuery UI from setting 'position: relative' on elements that were made draggable before being added to the DOM+
just change its css to position while appending $('<h1 class="draggable">Test</h1>') .draggable() .appendTo('#canvas').css('position','absolute'); $('<h2 class="draggable">Test 2</h2>') .draggable() .appendTo('#canvas').css('position','absolute'); Is this what you really want? EDIT: Though I couldnt figure out the root cause of the problem, these links might help you Link1 Link2 Link3

Categories : Jquery

Dynamically generating elements in IE7+8
I have a copy of WinXP with IE8 installed in the Virtual Machine. I've tried your link and it seems O.K. to me: I got the link, I've clicked on it and it works. The site jsfiddle.net (without /show in URL), however, does not work at all. I've played with browser and document modes. Id didn't keep the same margins, but it did work in all of them. Related to comments The fiddle http://jsfiddle.net/4Gr6f/2/show/ with the input element fails (in IE8; I don't have access to IE7) in all possible combinations of browser and document modes. Also, the body is empty in "Developer tools" (it had the a tag in your first fiddle). Additional info It seems that http://browsershots.org/ tests this properly. I have tried IE7, IE10 and FF21 with the link http://jsfiddle.net/4Gr6f/2/show/ and IE7 gav

Categories : Javascript

Add elements dynamically to SplitView in QML
It appears that the API does not provide support for dynamic insertion of new elements. Even if you do get it to work it would be a hack and might break with future releases. You may need to roll your own control to mimic the behavior you want. Ideally it should be backed by some sort of model.

Categories : Qt

Using buttonMarkup on dynamically created elements
The reason is because extra styling is appYou'll have to do it this way : Create a HTML anchor with data-role set to none. This will stop the styling on it. Hide this element by default <div class="button-container"> <a data-role="button" data-theme="b">Button</a> <a class="cloner" data-role="none" data-theme="b">Button</a> </div> Now you can use this button for you cloning. $("#add-icon-button").click(function () { //get the button and set it with button data-role and add button markup to it var $button = $(".cloner").clone().attr("data-role", "button").buttonMarkup({ icon: "star" }).removeClass("cloner"); //add the variable inside $("#new").html($button); }); Demo : http://jsfiddle.net/hungerpain/z4gnT/2/

Categories : Jquery

C++ vector elements dynamically instantiated or not
Simple is better. Just store the values directly in the vector, unless the values are (a) huge, (b) non-copyable (even then we have std::move in C++11), or (c) owned by another object (use shared_ptr or raw pointers).

Categories : C++

Adding HTML elements dynamically
You should $("#segmentTable tr").remove() (all <tr> nodes) before adding the new ones. Here's an edited fiddle. What's happening with your code is that you add X new nodes at the end of the table and then start deleting X nodes from the end of the table, in essence deleting some of the nodes you just added. You should either delete nodes from the top of the table or delete all nodes before you add the new ones (line I did in my fiddle).

Categories : Jquery

Not able to select dynamically created elements
The element "#QuadVenueSearch" does NOT exist on page when you are trying to access it. It will be created after you call $("#addQuad").popover('show') (or something similar to show the popup). Try calling $("#QuadVenueSearch").typeahead() after the popup is displayed. Hope this will help.

Categories : Jquery

Style to dynamically created elements
Just write it in some other function function somefunctiontoloadmoreitems() { $('.divlink').attr('href','www.facebook.com'); } Tell if this you wanted? I am not sure. function appendvalues(href, classname) { var maindiv = document.getElementById("maindiv").childNodes; for(var i=0; i<maindiv.length; i++) { maindiv[i].setAttribute("href",href); maindiv[i].setAttribute("class",classname); } } Try to implement this in your code.

Categories : Jquery

Dynamically .load()ed elements are not queryable
Since AJAX is asynchronous, you need to update the variable in the callback function: $('#carousel_01').load('content_01.html', function() { vimeoPlayers = document.querySelectorAll('iframe'); });

Categories : Jquery

Adding css to dynamically inserted elements
ID selectors map to getElementById which will only return the first match for an ID since IDs are supposed to be unique. $('#grid') will always select your first div with id="grid" You should be using a class instead or creating a unique ID for each "grid", since IDs are supposed to be unique.

Categories : Jquery

Setting `a href` elements dynamically
Here you go... This is using Twitter bootstrap and Jquery... Hopefully its helpful to you... The progress bar is a bit of a hack, but its a start and Im sure you can figure things out from there... The only thing that sucks is that the tabs are clickable, and that isn't what you wanted, since you want them to progress through the form without being able to click on the tabs....But the nuts and bolts are here DEMO HERE $(document).ready(function(){ //Progress bar calculation function setProgress(){ var length = $tabs.length; var index = ($('li').index($(".active")))+1; var width = (index/length)*100; $('#progressBar').css('width', width+'%'); } var $tabs = $('#tab_bar li'); setProgress(); $('#prevtab').on('click', function () { $tabs.filter('.active

Categories : Javascript

How to dynamically add elements to select2 when using ajax
//... .done(function (response) { var myValue = response.value; var myText = response.text; var o = new Option(myText, myValue); $(o).html(myText); $("select").append(o); $("select option[value='" + myValue + "']").attr('selected', 'selected'); }) //...

Categories : Javascript

Insert items into SVG elements dynamically
Inserting SVG elements based on data is exactly what d3js was built for. If you want to draw charts there are lots of libraries based on d3 which make life easier. My favourite is dimple but I suppose I'm a bit biased...

Categories : Javascript

Dynamically add UI Elements in CKEditor Dialog
Based off of this example, I ended up with this solution, where "main" is the ID of the original content. CKEDITOR.on('dialogDefinition', function(ev) { var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; if (dialogName == 'EmbedsDialog') { var main = dialogDefinition.getContents('main'); $('#embeds-fields tr').each(function() { var title = $(this).find('input[type=text]').val(), url = $(this).find('input[type=url]').val(); if(url != "") { main.add({ type : 'checkbox', label : title, }); } }); } });

Categories : Javascript

Dynamically adding an array of elements to a UI
I have a solution to the problem (thanks to the help from Boris Mocialov). The new UI component arrays were Instantiated, but the individual elements of the arrays were not Initialized. I've changed the for loop as shown below, to Initialize each element eg dimHLayouts[dimNumber] = new LinearLayout(getActivity()); It now works fine. for(int dimNumber=0; dimNumber<calcDimensionCount; dimNumber++) { // Setup the horizontal linear layout for the dimension dimHLayouts[dimNumber] = new LinearLayout(getActivity()); dimHLayouts[dimNumber].setOrientation(android.widget.LinearLayout.HORIZONTAL); dimHLayouts[dimNumber].setLayoutParams(lpDimHLayouts); // Setup the dimension label TextView dimTextViews[dimNumber] = new TextView(getActivity())

Categories : Android

JavaFX dynamically swapping elements
This is quite easy, you could change the contents of the scroll box depending on the value of the choice box. And I don't really know if you can do this strait in JavaFX but just open the project with your IDE and do it. if(choiceBox.value == 1) { //Draw stuff if first value is selected. }else if(choiceBox.value == 2) { //Draw stuff if second value is selected. }else if(choiceBox.value == 3) { //Draw stuff if third value is selected. } I have barely worked with JavaFX but from what I know you aren't able to do this strait out of their program.

Categories : Java

Dynamically added form elements
There are many approach to solve this problem. One solution to this is AJAX. say example you are using php 1) Sort form data with each use press button; jQuery Form. 2) a php function to process sql queries. 3) call php function in ajax in success method. 4) store value in database.

Categories : PHP

How do I take a JS array that has some elements that are also arrays and make ALL array elements top level elements
You don't need the second step to have an array of arrays, just join then split it by the comma: var array = ["item1", "item2", "item3, item4", "item5", "item6"] console.log(array.join(',').split(',')); Example fiddle

Categories : Javascript

How can I use live to loop through dynamically created elements?
You should be capturing the IDs in the AJAX success callback. Here is an example of if you were using .load(). var ids = []; $('#result').load('ajax/test.html', function() { $('#saveButton').on('click',function() { $('#result *[id]').each(function() { ids.push( $(this).attr('id') ); }); }); });

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.