Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Make message not reload every time

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

    Default

    Like Deadweight, I think a cookie would be a good choice.

    - the message box loads by default,
    - a click on the "close" button sets a cookie on the user's device and at the same time the message box is set to display:none (the cookie path is set to the root domain and maybe set the expiry for 30 days),
    - on each subsequent page-load, if the cookie is detected, the message box is again set to display:none

    Does that sound about right?

    Quirksmode has 3 convenient cookie JavaScript functions here: http://www.quirksmode.org/js/cookies.html - createcookie, readcookie and erasecookie
    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

  2. #12
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    905
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Default

    Thanks for your replies.
    I have put the message entirely into the megamenu, so that issue is resolved. But now something else comes up with the megamenu.
    Please have a look at www.lichaamengeest.be, and view the menu. In IE, when hovering the video, the whole menu disappears, whilst in FF and GC you can easily play the video there, as supposed to. How come?

    Because it is a heavy menu, I guess I'll give it a try to use the javascript option Arie proposed, so that reloading of the menu is avoided. Just two questions: is the script SEO-friendly, and is it possible to have the url without #?
    Last edited by chechu; 09-15-2014 at 08:55 AM.

  3. #13
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,824
    Thanks
    49
    Thanked 240 Times in 233 Posts
    Blog Entries
    56

    Default

    I haven't explicitly checked whether the script is SEO-friendly. But I think it is, because the pages on sites where I use this menu are easilly found. Moreover, as the whole menu (plus header etc.) is put in index.html (in its html format), it should be search-friendly.
    We can't have the url without #, because the whole method relies on hashchange, where # plays an essential role.
    As for the video, I don't know why is disappears in IE. Can you give me the code for the menu, so that I can check it out?

  4. #14
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    905
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Default

    If the # can't be removed, then I can't use it as all links will be broken.
    These are the codes for the menu:

    - html (I shortened it a bit):

    <div class="megamenu_container megamenu_light_bar megamenu_light">
    <div class="page_wrapper">
    <ul class="megamenu mobile">
    <li><a href="#" class="megamenu_drop">Inspiratie</a>
    <div class="dropdown_fullwidth">
    <span class="italic">
    <div class="col_3">
    <img src="img/geboden.jpg" />
    <br><a href="index.php"> korte gedachten (home)</a>
    </div>
    <div class="col_3">
    <img src="img/sitemap.jpg" />
    <br><a href="teksten4.php"> inzichten</a>
    </div>
    <div class="col_3">
    <img src="img/indrukken.jpg" />
    <br><a href="indrukken.php"> indruk-wekkend</a>
    </div>
    <div class="col_3">
    <img src="img/geluk.jpg" />
    <br><a href="watbetekentgeluk.php"> wat betekent geluk</a>
    </div>
    </span>
    <div class="divider-border1"></div>
    <div class="col_6">
    <div class="video_container">
    <iframe src="http://www.youtube.com/embed/jae24Q6Nbj4?rel=0"></iframe>
    </div>
    </div>
    <div class="col_6">
    <hr style="width:100%; height:1px; background-color:#eee; margin-top:-1px;">
    <div class="col_6">
    <span class="italic">
    <a href="teksten3.php#21">21| stop er nu toch eens mee</a>
    <br><a href="teksten3.php#22">22| tijd vragen schaadt</a>
    </span>
    </div>
    <div class="col_6">
    <span class="italic">
    <a href="teksten1.php#9">09| zoektocht en herbronning</a>
    <br><a href="teksten1.php#10">10| onvolmaaktheid</a>
    </span>
    </div>
    </div>
    <div class="col_6">
    <hr style="width:100%; height:1px; background-color:#eee; margin-top:-1px;">
    <div class="col_6">
    Wat betekent geluk?
    <span class="italic"><br><a href="watbetekentgeluk.php"> bekijk getuigenissen</a></span>
    </div>
    <div class="col_6">
    <div class="fb-like" data-href="http://facebook.com/lichaamengeest" data-send="true" data-layout="button_count" data-show-faces="true"></div>
    </div>
    </div>
    </div>
    </li>
    </ul>
    </div>
    </div>
    - css: http://lichaamengeest.be/css/menu.css

  5. #15
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,824
    Thanks
    49
    Thanked 240 Times in 233 Posts
    Blog Entries
    56

    Default

    Replace
    Code:
    <div class="video_container">
    <iframe src="http://www.youtube.com/embed/jae24Q6Nbj4?rel=0"></iframe>
    </div>
    with:
    Code:
    <div class="video_container" id="video_container" >
    <iframe src="http://www.youtube.com/embed/jae24Q6Nbj4?rel=0" ></iframe>
    </div>
    then put the following code on the page where you want the menu to do its job, at the end of the body section:
    Code:
    <script>
    //see http://www.pinlady.net/PluginDetect/IE/
    var tmp = document.documentMode, e, isIE;
    try{document.documentMode = "";}
    catch(e){ };
    isIE = typeof document.documentMode == "number" ? !0 : eval("/*@cc_on!@*/!1");
    try{document.documentMode = tmp;}
    catch(e){ };
    if (isIE)
    {
    document.getElementById('video_container').style.zIndex=-1;
    }
    </script>
    It all boils down to this: the video container must have a negative zIndex in IE, not in the other browsers.

    Why do you say If the # can't be removed, then I can't use it as all links will be broken? After all, you don't have hundreds of links.

  6. #16
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    905
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Default

    Thanks Arie.
    Strangely enough your solution only works for the video in the first menu-item, but not with the others.
    Through social media a lot has been linked to the site, so now I can't start changing the url's.

  7. #17
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,824
    Thanks
    49
    Thanked 240 Times in 233 Posts
    Blog Entries
    56

    Default

    I didn't know that you had the video on more than one page, so I used document.getElementById . But given the fact that you use it on more pages, we need a script that uses the classname of the video container. Here it is (at the end of the body section):
    Code:
    <script type="text/javascript">
    function correct_ie(tag,className) {
    var els = document.getElementsByTagName(tag)
    for (i=0;i<els.length; i++) {
    if (els.item(i).className == className){
    els.item(i).style.zIndex="-1";
    }
    }
    }
    if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {correct_ie('div','video_container')}
    </script>
    As for the links, I wasn't aware of the social media thing. Yes, that's a problem.

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

    chechu (09-16-2014)

  9. #18
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    905
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Default

    All works fine now. Thanks a lot, Arie!!
    Another thing I'm looking into is infinite scrolling for the homepage. As you seem to be a javascript wizard: any suggestions? I always ran into scripts conflicts before ...

  10. #19
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,824
    Thanks
    49
    Thanked 240 Times in 233 Posts
    Blog Entries
    56

    Default

    No, I'm not a real wizard. For instance, I don't know much about infinite scrolling. I'm not a fan of it, see this article.

  11. #20
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    905
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Default

    Indeed a feature to think about.
    Thanks, Arie.

Similar Threads

  1. How to make sure Javascript file load each time
    By lena in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 07-23-2012, 04:27 PM
  2. Make Layers Appear Over Time
    By TicTacWoe in forum Looking for such a script or service
    Replies: 40
    Last Post: 12-23-2009, 11:35 PM
  3. Replies: 0
    Last Post: 08-31-2007, 10:34 AM
  4. How Do I make A Time Based T.V. Show?
    By paagle in forum JavaScript
    Replies: 3
    Last Post: 12-21-2005, 06:55 AM
  5. Pausing up-down message scroller? One time scroll only question
    By TerraBlader in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 09-10-2005, 04:14 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
  •