Results 1 to 7 of 7

Thread: dynamic tab script and external javascript files

  1. #1
    Join Date
    Jul 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default dynamic tab script and external javascript files

    Hi, your tutorials are really helpful to me . i have a problem ( challenging with for some days ) when i used this tab script (http://www.dynamicdrive.com/dynamici...suppliment.htm ) and i include other PHP files through tabs my only problem is that JavaScript in that file will be disabled and can not be read .

    more explanation :
    i have JavaScript files that are included in each of my php files . when i include php files in tab script and click on the tab the javascript in that php file can no be read .

    any suggestion would be appreciated .

  2. #2
    Join Date
    Aug 2004
    Posts
    10,138
    Thanks
    3
    Thanked 1,007 Times in 992 Posts
    Blog Entries
    16

    Default

    If the external pages contain JavaScript (especially run time scripts), you'll need to switch to using the IFRAME mode of fetching them for those tabs (versus Ajax mode).

  3. #3
    Join Date
    Jul 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks, I guessed that solution and i switched to using Iframe ( my only problem is how to create preloading for Iframe )

    I used ( onload ( sth) ) but with no appropriate result.

    It would be fine if you explain how to create a preload function for Iframe .

    tanks

  4. #4
    Join Date
    Aug 2004
    Posts
    10,138
    Thanks
    3
    Thanked 1,007 Times in 992 Posts
    Blog Entries
    16

    Default

    One way to preload the IFRAME contents it to load them inside invisible IFRAMEs when the page first loads. Inside the ajaxtabscontent.js, below the following line, add the lines in red to do this:

    Code:
    				this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
    				if (this.tabs[i].getAttribute("rel")=="#iframe"){ //preload IFRAME contents
    					document.write('<iframe src="'+this.tabs[i].href+'" style="position:absolute;left:0;top:0;visibility:hidden"></iframe>')
    				}

  5. #5
    Join Date
    Jul 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I add your codes to the js file but to make it clear :

    i want this code to be appear in tab section :

    ddajaxtabssettings.loadstatustext="<img src='ajaxtabs/loading.gif' /> Requesting content..."

    so there would be no difference between Iframe and ajaxcontent

    My question is where to add it ?

  6. #6
    Join Date
    Oct 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hey guys.

    I'm sorry for pulling this old thread to the top but it explains exacly my problem.

    I'm using the Ajax Tabs 2.2 to get content from 7 websites and want to preload each iframe. The on-demand-load is much to slow cause of the webpages self so the preload would be "feeling" much quicker.

    The tabs are implemented via:
    <li><a href="link_to_url" rel="#iframe">link</a></li>

    The described workaround (code in red) is implemented and the iframes will be injected properly but if I click on a tab the iframe will be loaded at that moment again.

    I also tried the href="'javascript: instance.loadiframepage('pageurl)'" but then the tabs are not working anymore.

    The script initializing is done via the example code:

    Code:
    var countries=new ddajaxtabs('countrytabs', 'countrydivcontainer')
    countries.setpersist(true)
    countries.setselectedClassTarget('link') //'link' or 'linkparent'
    countries.init()
    I read the howto 3 times but I'm not able to determine the root cause.

    Can someone tell me what to do or is able to complete the code?

    This would be very nice!
    Thank you very much,
    Kind Regards
    Mike

  7. #7
    Join Date
    Aug 2004
    Posts
    10,138
    Thanks
    3
    Thanked 1,007 Times in 992 Posts
    Blog Entries
    16

    Default

    The described workaround (code in red) is implemented and the iframes will be injected properly but if I click on a tab the iframe will be loaded at that moment again.
    I'm a little confused- are you saying the preload code works as far as no errors are generated, but that the contents of your IFRAMEs are still not preloaded?
    DD Admin

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •