How to fix a div on the page that is displayed in the iframe?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
5 views
On the website page displayed in iframe with scroll. Need after drag&drop, to fix a div at a specific location of a country that is in an iframe. How to do it? Google did not help.

in the iframe src address is added dynamically. Ie VA can enter absolutely any address.
by | 5 views

4 Answers

0 like 0 dislike
Do not quite understand the problem. As I understand it, you need:
1)Add a div in the iframe when drag n drop
2)diva styles should be written position:absolute (relative to the parent, ie the frame)
3)to Appoint the diva position (top and left)
\r
Something like this:
\r
//create an iframe in printsepe not matter how you create it, the main thing to name it var iframe = document.createElement("iframe"); //create a div and assign styles var div = iframe.document.createElement("div"); div.style.position = "absolute"; div.style.top = x+"px"; div.style.left = y+"px"; iframe.document.body.appendChild(div); 
by
0 like 0 dislike
For example:
the iframe (the map) you have 1200x1200, and the visible part of it 800x600. Index div (label) this is the usual position:absolute but margin it = X and Y coordinates (and 0-1200 0-1200), which he assigns drag-n-drop this item.
\r
\r
Copy Source | Copy HTML\r$('#LocationMap').click(function(e){\r var x = e.pageX - this.offsetLeft;\r var y = e.pageY - this.offsetTop;\r $("input[name=location_x]").val(x);\r $("input[name=location_y]").val(y);\r $("#Flag").css({"margin-left": ""+x+"px"}).css({"margin-top": ""+y+"px"});\r});\r \r

\r
I did something like this:
1. In the admin (the blonde) just pokes the mouse on the map and the "Save" button for each catalog item.
2. Users see it so
by
0 like 0 dislike
I do not quite understand what you want, but maybe: position:absolute; will help you?
by
0 like 0 dislike
If the iframe with the same domain, then you can add there (inside the document in the iframe) to the label with position:absolute, as written above. Then she will normally scroll with the map. Find the coordinates after drag'n'drop is possible through the scrollTop/scrollLeft of the document in the iframe and position the iframe on the page.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
27,842 users