Results 1 to 6 of 6

Thread: Problem with background image using anylinkmenu.js

  1. #1
    Join Date
    Jul 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem with background image using anylinkmenu.js

    Script: AnyLink JS Drop Down Menu v2.3
    http://www.dynamicdrive.com/dynamici...pmenuindex.htm

    I want to create a dropdown menu on navigation bar, just under a banner on an html page. Around the page , there is a background image, that displays left & right of the content of my webpages- i'm using css
    body {background: url(images/background.jpg) top center;}

    Everything was fine until I implemented the drop down menu using "AnyLink JS Drop Down Menu v2.0". Now, with the dropdownmenu working correctly, at the bottom of each page, the background image is displayed with a hight of 6/7 text lines.
    This effect happens as soon as the script is launched - if I put <!-- --> to the html line <script type="text/javascript" src="../doc_commun/scripts/anylinkmenu.js"></script>, the background image finishes right at the same height than the content of the web pages. (of course dropdown effect is not working anymore)


    Any hint to improve this ?

    Thanks

    Guy
    Last edited by guy67400; 08-05-2013 at 01:43 PM. Reason: Follow proper posting format

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question.


    Please post a link to the page on your site that contains the problematic script so we can check it out.


    You're asking us to work blind at the moment so until you can provide us with the information above, I'm afraid we can't offer any real help.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If I understand the question, perhaps editing the script to place the created content at the beginning, rather than at the end of the body will help. Using a text only editor like NotePad, find this function in the anylinkmenu.js file (around line #154:

    Code:
    addDiv:function(divid, divclass, inlinestyle){
    	var el=document.createElement("div")
    	if (divid)
    		el.id=divid
    	el.className=divclass
    	if (inlinestyle!="" && typeof el.style.cssText=="string")
    		el.style.cssText=inlinestyle
    	else if (inlinestyle!="")
    		el.setAttribute('style', inlinestyle)
    	document.body.appendChild(el)
    	return el
    },
    Change the highlighted line as shown:

    Code:
    addDiv:function(divid, divclass, inlinestyle){
    	var el=document.createElement("div")
    	if (divid)
    		el.id=divid
    	el.className=divclass
    	if (inlinestyle!="" && typeof el.style.cssText=="string")
    		el.style.cssText=inlinestyle
    	else if (inlinestyle!="")
    		el.setAttribute('style', inlinestyle)
    	document.body.insertBefore(el, document.body.firstChild)
    	return el
    },
    Save and use that version.

    The browser cache may need to be cleared and/or the page refreshed to see changes.

    But this might create the same undesirable effect, only this time at the top of the page. If it does, it's probably due to the markup and/or styles of the page and we would have to have a link to that page to figure it out.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    Last edited by jscheuer1; 08-01-2013 at 06:54 AM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jul 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    background size problem.zipSorry for not following the guidelines of "proper posting format". I updated my post to include link to the script I use.

    John, thank you for your reply.
    I changed the script as per your suggestion, and the undesirable effect is at the top of the page as you suspected.

    I uploaded the folder "background size problem.zip" with related files (.css, dropdown content, html page called "index.html", background image) so that you can see the problem
    The background image should finish right under the page bottom with text "Nous contacter CGU Recevoir la lettre d'information" but it is 3/4 lines longer

    Thank you for your time spend on this matter

    Regards

    Guy

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, you're missing styles from the demo page:

    Code:
    <link rel="stylesheet" type="text/css" href="anylinkmenu.css" />
    Place that tag in the head of the page after the scripts, and download the css file from the demo page, put it in the same folder as the page.

    If you don't want to see the shadows - Using a text only editor like NotePad, change them (at the end of the css file) like so:

    Code:
    /* ######### class for shadow DIV ######### */
    
    
    .anylinkshadow{ /*CSS for shadow. Keep this as is */
    position: absolute;
    left: 0;
    top: 0;
    z-index: 99; /*zIndex for shadow*/
    background: transparent;
    visibility: hidden;
    }
    The browser cache may need to be cleared and/or the page refreshed to see changes.

    Oh, and there was a gap at the bottom even without the scripts, so it's hard to tell. But there was less of a gap without them, and the same less of a gap when the styles were added and the scripts included. I think having the other images missing might (probably does*) account for the remaining gap. If not, it's nothing to do with the menu, as I say, there is a gap there even without the menu's scripts.


    *further testing seems to show this is the case
    Last edited by jscheuer1; 08-05-2013 at 04:32 PM. Reason: saw all menu styles were missing
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jul 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You are right that I did'nt want the shadow effect on the drop down menus & I removed the .css class (too fast it seems!)

    Using your hint = put back the shadow class with transparent background in the existing .css file solve the bottom page - background alignment effect on the full website

    Thank you for your help on this matter

    Guy
    (This is my french given name)

Similar Threads

  1. anylinkmenu problem
    By ailisWesties in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 08-22-2012, 01:39 AM
  2. Odd Image Behavior in IE7 and Firefox 3 with AnyLinkMenu
    By icywindow in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-05-2010, 07:45 PM
  3. IE background image problem
    By Bennelliott in forum CSS
    Replies: 3
    Last Post: 06-08-2007, 08:27 PM
  4. Replies: 4
    Last Post: 11-25-2006, 12:04 PM
  5. Firefox Background Image Problem
    By mannyotr in forum CSS
    Replies: 7
    Last Post: 03-17-2006, 06:46 PM

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
  •