Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to view one html element twice on the same page, or must I create a duplicate?

I am creating a site that allows viewing and editing the contents of the 'src-div' contents within the 'edit-div.' I am not editing the src-div directly, because its thumbnailed using css zoom property.

I have considered using knockout.js to bind both elements to an observable. Currently, I have implemented the feature with jquery .html() function: simply set edit-div innerhtml to src-div innerhtml on 'select', and reverse the process after changes are made to edit-div to update the src-div.

I am wondering if I really need 2 divs here, or if there is some way to actually view the same element twice on a page, and any changes made will automatically reflect in both 'views,' elimiating the need to copy innerhtml property back and forth between two elements.

essentially, this is like a mirror effect, without the flip.

the closest thing I found so far is:

http://developer.apple.com/library/safari/#documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Reflections/Reflections.html

Any recommended practices for performing this task are appreciated.

like image 613
CodeToad Avatar asked Aug 03 '12 20:08

CodeToad


People also ask

How do you repeat an element in HTML?

How to use it: Download and import the repeatjs plugin into the HTML document. Add the repeat-element attribute to the element you want to duplicate and specify the number of times to copy. Use the repeat-text attribute if you only want to duplicate the text within the element.

Can 2 HTML elements have the same ID?

The HTML id attribute is used to specify a unique id for an HTML element. You cannot have more than one element with the same id in an HTML document.

Can an attribute be applied multiple times to the same element?

It is not valid to have the same attribute name twice in an element.

How many times can I use the same class on a page HTML?

Yes of course, as many times as you wish.


1 Answers

(Almost) everything you see on a page has a counterpart in the DOM. Everything in the DOM gets exactly rendered one time (apart from pseudo-classes). And every node in the DOM can only have one parent (no exclusions).

Unfortunately you'll have to clone the specific node and add changes to both, as there is no copy & translate mechanism in the current CSS documentation.

like image 119
Zeta Avatar answered Sep 19 '22 13:09

Zeta