Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Bug Reports
  3. Refresh needed to actualize css/js

Refresh needed to actualize css/js

Scheduled Pinned Locked Moved Bug Reports
9 Posts 2 Posters 963 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leednl
    wrote on last edited by leednl
    #1

    Hi Armin,
    I encounter a problem when I navigate on the website I'm working on. It seems like some of the custom css/js only work after a refresh. When I navigate from a page to an other one (by clicking on menu links customized in html), some of the effects only supposed to be on the previous page remain on the new one. I have to refresh the new page i'm visiting to kind of "cancel" the effects from the previous page.

    Do you know where this problem comes from? Is there a way to automatically refresh a page when you visit it?

    I hope I have been clear enough :)
    Lee xx

    1 Reply Last reply
    0
    • arminunruhA Offline
      arminunruhA Offline
      arminunruh
      Global Moderator
      wrote on last edited by arminunruh
      #2

      Post a link of your website where you experience the issue.
      :)

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leednl
        wrote on last edited by leednl
        #3

        http://leberg.de/ :)

        • when you scroll down the homepage and then go to an other page (the color of the links becomes black again after a refresh)
        • when you go from a page to the work page: the hover preview (on the thumbnail) only work after a refresh.
        1 Reply Last reply
        0
        • arminunruhA Offline
          arminunruhA Offline
          arminunruh
          Global Moderator
          wrote on last edited by
          #4

          hey leednl, so for

          "when you scroll down the homepage and then go to an other page (the color of the links becomes black again after a refresh)
          "

          which links?

          "when you go from a page to the work page: the hover preview (on the thumbnail) only work after a refresh.
          "

          I only see an image with text underneath, I don't see a hover preview.

          Maybe I understand it better if you can show me screenshots?

          1 Reply Last reply
          0
          • L Offline
            L Offline
            leednl
            wrote on last edited by leednl
            #5

            Yes sure!

            So here is the homepage

            0_1488815649361_Capture d’écran 2017-03-06 à 16.52.09.png

            when you scroll down the links become blue

            0_1488815686862_Capture d’écran 2017-03-06 à 16.52.20.png

            and when you click on one of the link to go to an other page (here: about), the links remain blue.
            0_1488815718511_Capture d’écran 2017-03-06 à 16.52.29.png

            I have to refresh the page to have them black again

            0_1488815765149_Capture d’écran 2017-03-06 à 16.52.35.png

            I recorded a quick video so that you can see everything: https://we.tl/l4eWrUE5XT

            Thanks :)

            1 Reply Last reply
            0
            • arminunruhA Offline
              arminunruhA Offline
              arminunruh
              Global Moderator
              wrote on last edited by arminunruh
              #6

              Ah now i understand. I think that's some custom code that you are using right?

              Can you post your javascript code that you used here?

              Edit:

              Ah ok I found the code myself:

              
              /// scroll
              
              Frontend.GlobalEvents.on("newpageshown", function(layoutObj, type, obj){
                              var scroll_pos = 0;
                              var animation_begin_pos = 900; //where you want the animation to begin
                              var animation_end_pos = 1200; //where you want the animation to stop
                              jQuery(document).scroll(function() { 
                                  scroll_pos = jQuery(this).scrollTop();
                                  if(scroll_pos >= animation_begin_pos && scroll_pos <= animation_end_pos ) {
                                      jQuery("body.slug-home a").css('color', 'blue');
                                  } else {
                                      jQuery("body.slug-home a").css('color', 'black');
                                  }
                              });
              
              });
              
              ///scroll end
              
              var colors = ['#f6e9de', '#f0f0f1']
              Frontend.GlobalEvents.on("newpageshown", function(){
              	var ix = getRandomInt(0, colors.length);
              	var color = colors[ix];
              	jQuery('body').css('background-color', color);
              });
              
              // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
              // Returns a random integer between min (included) and max (excluded)
              
              function getRandomInt(min, max) {
              	min = Math.ceil(min);
              	max = Math.floor(max);
              	return Math.floor(Math.random() * (max - min)) + min;
              }
              
              /// thumbnail video hover
              
              window.laytheme.on("newpageshown", function(){
                  jQuery('body.slug-work video').each(function(){
                      this.pause(); 
                      });
                      jQuery('body.slug-work video').on('mouseenter', function(){
                         this.play(); 
                      });
                      jQuery('body.slug-work video').on('mouseleave', function(){
                         this.pause(); 
                  });
              });
              

              Did you code that by yourself? Maybe you can ask the person who coded this to fix the issues you're having. Because those issues are not directly lay theme related but related to your custom javascript.

              I think you should try and improve the scrolling code a bit. On smaller screens the text never becomes blue. The "animation_begin_pos" number should be lower or should depend on window.innerHeight instead of a number.

              Then when you go to any page, those blue links should be reset to be black. So on "nepageshown" just remove the css of these links.

              L 1 Reply Last reply
              0
              • arminunruhA arminunruh

                Ah now i understand. I think that's some custom code that you are using right?

                Can you post your javascript code that you used here?

                Edit:

                Ah ok I found the code myself:

                
                /// scroll
                
                Frontend.GlobalEvents.on("newpageshown", function(layoutObj, type, obj){
                                var scroll_pos = 0;
                                var animation_begin_pos = 900; //where you want the animation to begin
                                var animation_end_pos = 1200; //where you want the animation to stop
                                jQuery(document).scroll(function() { 
                                    scroll_pos = jQuery(this).scrollTop();
                                    if(scroll_pos >= animation_begin_pos && scroll_pos <= animation_end_pos ) {
                                        jQuery("body.slug-home a").css('color', 'blue');
                                    } else {
                                        jQuery("body.slug-home a").css('color', 'black');
                                    }
                                });
                
                });
                
                ///scroll end
                
                var colors = ['#f6e9de', '#f0f0f1']
                Frontend.GlobalEvents.on("newpageshown", function(){
                	var ix = getRandomInt(0, colors.length);
                	var color = colors[ix];
                	jQuery('body').css('background-color', color);
                });
                
                // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
                // Returns a random integer between min (included) and max (excluded)
                
                function getRandomInt(min, max) {
                	min = Math.ceil(min);
                	max = Math.floor(max);
                	return Math.floor(Math.random() * (max - min)) + min;
                }
                
                /// thumbnail video hover
                
                window.laytheme.on("newpageshown", function(){
                    jQuery('body.slug-work video').each(function(){
                        this.pause(); 
                        });
                        jQuery('body.slug-work video').on('mouseenter', function(){
                           this.play(); 
                        });
                        jQuery('body.slug-work video').on('mouseleave', function(){
                           this.pause(); 
                    });
                });
                

                Did you code that by yourself? Maybe you can ask the person who coded this to fix the issues you're having. Because those issues are not directly lay theme related but related to your custom javascript.

                I think you should try and improve the scrolling code a bit. On smaller screens the text never becomes blue. The "animation_begin_pos" number should be lower or should depend on window.innerHeight instead of a number.

                Then when you go to any page, those blue links should be reset to be black. So on "nepageshown" just remove the css of these links.

                L Offline
                L Offline
                leednl
                wrote on last edited by leednl
                #7

                @arminunruh Actually I asked you in an other topic how to animate videos on hover. Thanks for your help! I'm gonna try to fix the issues with js. :)

                1 Reply Last reply
                0
                • arminunruhA Offline
                  arminunruhA Offline
                  arminunruh
                  Global Moderator
                  wrote on last edited by
                  #8

                  Haha ok!

                  Well for the videos, if you want all videos to autoplay on hover this would be easier:

                  jQuery(document).on('mouseenter', "video", function(){
                        this.play(); 
                  });
                  jQuery(document).on('mouseleave', "video", function(){
                         this.pause(); 
                  });
                  

                  Use this code without the wrapping "window.laytheme.on("newpageshown", function(){"

                  L 1 Reply Last reply
                  1
                  • arminunruhA arminunruh

                    Haha ok!

                    Well for the videos, if you want all videos to autoplay on hover this would be easier:

                    jQuery(document).on('mouseenter', "video", function(){
                          this.play(); 
                    });
                    jQuery(document).on('mouseleave', "video", function(){
                           this.pause(); 
                    });
                    

                    Use this code without the wrapping "window.laytheme.on("newpageshown", function(){"

                    L Offline
                    L Offline
                    leednl
                    wrote on last edited by
                    #9

                    @arminunruh thank you! it works now! (and sorry for my very late reply)

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    I also code custom websites or custom Lay features.
                    💿 Email me here: 💿
                    info@laytheme.com

                    Before you post:
                    1. When using a WordPress Cache plugin, disable it or clear your cache.
                    2. Update Lay Theme and all Lay Theme Addons
                    3. Disable all Plugins
                    4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                    This often solves issues you might run into

                    When you post:
                    1. Post a link to where the problem is
                    2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                    3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                    Online Users
                    A
                    alasdair17
                    K
                    Kai Schecker
                    Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                    laytheme.com
                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Search