|
|
|
|
![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED]
Posts: 161 Joined: 7-December 07 From: Melbourne,Australia Member No.: 54,372 |
Post
#1
Dec 13 2007, 05:40 PM
Hey i need help I was wondering if there is a code that allows you to target ur link to a div layer.. lets say eg.. i got CODE <a href="www.example.com">Example</a> i want that page to show in the div layer below on the same page.Is there a way i can do that? . im tryin to avoid using frames. thanks |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [MODERATOR]
Posts: 2,672 Joined: 22-June 05 From: 127.0.0.1 — no place like it. Member No.: 8,528 myCENT:33.50 |
Post
#2
Dec 13 2007, 10:50 PM
You're either looking for AJAX or PHP's include function. If you don't mind the page reloading, then go with PHP's include function. But if you do, then AJAX is what you want.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED]
Posts: 161 Joined: 7-December 07 From: Melbourne,Australia Member No.: 54,372 |
Post
#3
Dec 14 2007, 03:24 AM
thanks for that.. ive tried it out and yeah it works.. now the problem is .. what if the external link had css attached to it.. cause i wanted the gallery page to load onto the div layer, now it loads but the lighbox doesnt work. do i have to attach something or do something to it? |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [MODERATOR]
Posts: 7,255 Joined: 21-September 04 From: 9r33|\| 399$ 4|\|D 5P4/\/\ Member No.: 1,218 myCENT:83.20 |
Post
#4
Dec 14 2007, 03:37 AM
Well we would need to see how you have the pages set up before we know how to fix the problem, so if you can load a demo page to your account or post the code to the gallery page to take a look and see what it looks like. Just remember although your loading an external page that page needs to have the proper coding, and so make sure your gallery page has this in your header CODE <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="js/lightbox.js"></script> and of course have this connected to your pics as well CODE rel="lightbox" If you need more help I know lightbox pretty well, and enough ajax and php to fix the problem, but before that just post a demo or the code your working with and we can fix it right up. Also let us know what method your using since you didn't mention in the post which way you went. This post has been edited by Saint_Michael: Dec 14 2007, 03:40 AM |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Post
#5
Dec 14 2007, 03:45 AM
I know the problem here .. the external pages you are loading even though it has CSS styles attached to it dont render all properly when its fetched from outside the parent document. THe only way I've found out a fix is to have the javascripts and CSS on the parent document then when the ajaxed document is pulled in it should work. I found this out when working on my own project. |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED]
Posts: 161 Joined: 7-December 07 From: Melbourne,Australia Member No.: 54,372 |
Post
#6
Dec 14 2007, 07:56 AM
QUOTE(Saint_Michael @ Dec 14 2007, 02:37 PM) [snapback]362352[/snapback] If you need more help I know lightbox pretty well, and enough ajax and php to fix the problem, but before that just post a demo or the code your working with and we can fix it right up. Also let us know what method your using since you didn't mention in the post which way you went. thanks guys... okay this is the page im working on http://www.keegonguyen.com/home.html this is what i used in the head of the html cause i got it on dynamic drive [codebox]<script type="text/javascript"> /*********************************************** * Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code ***********************************************/ var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no) var loadedobjects="" var rootdomain="http://"+window.location.hostname var bustcacheparameter="" function ajaxpage(url, containerid){ var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } if (bustcachevar) //if bust caching of external page bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() page_request.open('GET', url+bustcacheparameter, true) page_request.send(null) } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) document.getElementById(containerid).innerHTML=page_request.responseText } function loadobjs(){ if (!document.getElementById) return for (i=0; i<arguments.length; i++){ var file=arguments[i] var fileref="" if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding if (file.indexOf(".js")!=-1){ //If object is a js file fileref=document.createElement('script') fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", file); } else if (file.indexOf(".css")!=-1){ //If object is a css file fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("type", "text/css"); fileref.setAttribute("href", file); } } if (fileref!=""){ document.getElementsByTagName("head").item(0).appendChild(fileref) loadedobjects+=file+" " //Remember this object as being already added to page } } } </script>[/codebox] and below is what it told me to do to my link CODE <a href="java script:ajaxpage('photo.htm','main');">Photo</a> the content, i want it to appear in the Div Id = Main this is my div for the main content CODE <div class="myCSS" id="main">Content goes here</div> The link to my test photo is www.keegonguyen.com/photo.html and that photo.html is located in /public_html folder of mine The layout are all Div layers.. The top one .. is #banner , the navigation i gave it the ID #navbar and the main content #main all i did was added 3 div layers , i hope thats enough information.. let me know if you need more. thanks again guys. EDIT : IT WORKS NOW. IT LOADS ONTO THE DIV BUT THE BACKGROUND IS SHOWING! help [note=truefusion]Put all coding into the CODE bbcode[/note] This post has been edited by truefusion: Dec 14 2007, 10:59 AM |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Post
#7
Dec 14 2007, 09:07 AM
I think the background showing is because of a default margin effect on image tags <img> you can try set margins for all images to zero. I think that should fix it. so try adding this line into your css file. [codebox]img { margin: 0px; } [/codebox] This should set margins to all image tags to 0 value. |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED]
Posts: 161 Joined: 7-December 07 From: Melbourne,Australia Member No.: 54,372 |
Post
#8
Dec 14 2007, 09:30 AM
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Post
#9
Dec 14 2007, 09:37 AM
it shouldnt matter where it is but if there is 2 img styles the bottom one should over write I think. your css file dosent have it though i checked. I know the problem has to be margins because thats the only thing it looks like. you could try [codebox]* { margin 0px; }[/codebox] it might work. I should really try and copy the page/site over to try out myself [hr=noshade] [/hr] oh I think I see it now. it looks like you have a <p> tag around the image thats whats probably causing the margins. you could do [codebox]p { margin: 0px; }[/codebox] edit: Dont do the previous suggestion of * { margin: 0px} its crazy it will apply 0 margins to everything. You probably only want to apply 0 margins to things you want to have zero margins not everything. |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [MODERATOR]
Posts: 2,672 Joined: 22-June 05 From: 127.0.0.1 — no place like it. Member No.: 8,528 myCENT:33.50 |
Post
#10
Dec 14 2007, 11:02 AM
QUOTE(keego @ Dec 14 2007, 02:56 AM) [snapback]362410[/snapback] BUT THE BACKGROUND IS SHOWING! help What browser are you testing this in? |
![]() ![]() |
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
1 | dontmaimyourself | 6,914 | 1st August 2004 - 03:47 PM Last post by: Spectre |
|||
![]() |
3 | josh_sg1 | 4,240 | 12th October 2004 - 12:02 AM Last post by: s2city |
|||
![]() |
6 | dontmaimyourself | 3,418 | 21st October 2004 - 05:13 PM Last post by: dontmaimyourself |
|||
![]() |
0 | Zenchi | 5,721 | 4th November 2004 - 02:42 AM Last post by: Zenchi |
|||
![]() |
2 | round | 2,797 | 18th November 2004 - 11:35 PM Last post by: round |
|||
![]() |
0 | remonit | 3,133 | 15th November 2004 - 08:25 PM Last post by: remonit |
|||
![]() |
1 | Atthack | 319 | 1st July 2007 - 04:04 PM Last post by: Plenoptic |
|||
![]() |
3 | kvarnerexpress | 3,229 | 7th January 2005 - 02:05 PM Last post by: SENV |
|||
![]() |
4 | spawn_syxx9 | 3,275 | 22nd January 2005 - 05:04 AM Last post by: OpaQue |
|||
![]() |
2 | mahesh2k | 4,703 | 9th February 2005 - 03:39 PM Last post by: mahesh2k |
|||
![]() |
2 | rudeturk | 3,483 | 26th February 2009 - 01:09 PM Last post by: iG-buber |
|||
![]() |
0 | ezincenter | 1,720 | 16th February 2005 - 11:29 AM Last post by: ezincenter |
|||
![]() |
0 | ezincenter | 2,212 | 16th February 2005 - 11:31 AM Last post by: ezincenter |
|||
![]() |
0 | ezincenter | 2,088 | 16th February 2005 - 11:42 AM Last post by: ezincenter |
|||
![]() |
0 | Matt1eD | 1,770 | 15th March 2005 - 04:32 PM Last post by: Matt1eD |
|||
|
Open Discussion | Time is now: 8th November 2009 - 09:07 AM |
Web Hosting Powered by ComputingHost.com.