Results 1 to 8 of 8

Thread: Ajax Tabs Content Script problem

  1. #1
    Join Date
    Sep 2009
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation Ajax Tabs Content Script problem

    1) Script Title: Ajax Tabs Content Script (v 2.2)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tent/index.htm

    3) Describe problem:
    If the script tags are not just above the </body>, the script has no effect whatsoever.
    Is there a way in which the script content could be moved in the external js and perhaps calling the action with onClick or onMouseOver? Hence avoiding a rather wrong positioning of the script tags. in the body.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    If the script tags are not just above the </body>, the script has no effect whatsoever.
    Versus where on the page? In general as long as the SCRIPT tag is defined before the initialization code (ie: new ddajaxtabs("countrytabs", "countrydivcontainer")) is called on the page, it should work.

    Is there a way in which the script content could be moved in the external js and perhaps calling the action with onClick or onMouseOver?
    By script content, do you mean the HTML for each "tabbed" content? If so, the script already supports that, through either Ajax or IFRAME.
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    suv (09-23-2009)

  4. #3
    Join Date
    Sep 2009
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Code:
    By script content, do you mean the HTML for each "tabbed" content?
    What I meant is the content inside the <script> tags, where you declare the function ddajaxtabs ans assign it to a new variable.
    Is it possible somehow to move this part in the external javascript file so it can be called on mouse over or on click from the <a> tag.

    This way we can avoid the problem with positioning the <script> tags, which as I said before, if you don't put the just before </body> the end of the body tag, they have no effect whatsoever.
    I've tried to insert it elsewhere in the body but with no success.

  5. #4
    Join Date
    Sep 2008
    Location
    Seattle, WA
    Posts
    135
    Thanks
    1
    Thanked 11 Times in 11 Posts

    Default

    I don't understand the problem of just leaving it there... above the </body> tag. That's what SEO guidelines recommend, put it at the bottom of the page.

  6. #5
    Join Date
    Sep 2009
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by simcomedia View Post
    I don't understand the problem of just leaving it there... above the </body> tag. That's what SEO guidelines recommend, put it at the bottom of the page.
    Thanks for the reply.
    The problem is that in certain CMS you cannot place it just above the </body> tag due to limited privileges.
    So if I try to insert the code using the CMS, it will place it anywhere else but in the proper position... and there the problem appears.

  7. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Quote Originally Posted by suv View Post
    Code:
    By script content, do you mean the HTML for each "tabbed" content?
    What I meant is the content inside the <script> tags, where you declare the function ddajaxtabs ans assign it to a new variable.
    Is it possible somehow to move this part in the external javascript file so it can be called on mouse over or on click from the <a> tag.

    This way we can avoid the problem with positioning the <script> tags, which as I said before, if you don't put the just before </body> the end of the body tag, they have no effect whatsoever.
    I've tried to insert it elsewhere in the body but with no success.
    If you mean the invocation code such as:

    Code:
    <script type="text/javascript">
    
    var myflowers=new ddajaxtabs("flowertabs", "flowerdivcontainer")
    myflowers.setpersist(true)
    myflowers.setselectedClassTarget("link") //"link" or "linkparent"
    myflowers.init(3000)
    
    </script>
    What you can do is have it run when the page fully loads. This makes it possible for you to place the above anywhere on the page (ie: HEAD section), instead of having to follow the HTML of the Tabs and Tab Contents. To do this, you'd modify the above to become:

    Code:
    <script type="text/javascript">
    
    window.onload=function(){
    var myflowers=new ddajaxtabs("flowertabs", "flowerdivcontainer")
    myflowers.setpersist(true)
    myflowers.setselectedClassTarget("link") //"link" or "linkparent"
    myflowers.init(3000)
    }
    
    </script>
    Note that the above doesn't take into account other scripts also running themselves window.onload, which if there are will fail.
    DD Admin

  8. The Following User Says Thank You to ddadmin For This Useful Post:

    suv (09-26-2009)

  9. #7
    Join Date
    Sep 2009
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply, and it failed indeed.

    Is there a way in which the script can be moved outside the html file, say in the external js?

  10. #8
    Join Date
    Sep 2009
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Fixed.
    it works now, although I'm still wondering how to make it load onMouseOver
    anybody? suggestions?

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
  •