Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1204779

    Hi all – funny one this.

    I have this page – http://ig.brother.design/about-us/ where the green box heading that reads “We specialise in…” is fixed so that each Avia fullscreen section starts with We specialise in… and ends in …the uncommon; …partnerships; …individuals; …family life etc.

    It works well in principle but because We specialise in is a fixed div it overlaps the footer at the end and looks odd.

    I have tried various javascript to make it fade at a certain point on page scroll; javascript to “un-fix the position”/”change position class” at a certain point; z-index to make it masked and nothing has worked. To a point where I think some script in Enfold is clashing considering the number of scripts I’ve tried.

    Does anyone have any ideas on how to achieve what I am after? My favoured result would be javascript to “un-fix the position” at a certain point (%) on page scroll. However, any solutions would be considered.

    Examples of scripts I’ve tried…
    http://jsfiddle.net/b43hj/
    http://jsfiddle.net/jakecigar/uMKr5/1/ (with increased y-axis trigger)

    I couldn’t get either to work as a code snippet or in child theme header and even if I did I would probably have to replace the y-axis trigger with a percentage in order for it to be responsive.

    Any help, ideas or tips would be really appreciated.

    Dominic

    #1204787

    first: i am surprised that the negative z-index should work in all browsers!

    Is this something you could live with? : https://webers-testseite.de/pureinstall/alb-testseite/

    Look to the responsvie case on narrower screens.

    • This reply was modified 4 years, 8 months ago by Guenni007.
    #1204796

    Next question : on all these pages – will the recurring content be placed at the end using “page as footer” ?

    Once again edit: it would be nice to have a custom-class to that fixed div:
    f.e.:

    <div class="fixed-heading" style="position: fixed; z-index: -5;">
    <h2 style="padding: 20px; background: #96c451; color: #fff;">We specialise in…</h2>
    </div>

    This is better to select for any css or script.
    Because Enfold has allready implemented the waypoints script – it is easy to use this. You can have that last but one color-section ( #emergency ) as a trigger. When it comes to viewport you can let things happen. ( Add classes f.e. to that fixed div )

    #1204832

    this would do the job for you – for ipad etc it is better to have z-index positiv values.

    for quick css:

    .fixed-heading {
        opacity: 1;
        transition: opacity 0.3s ease;
    }
    
    .fixed-heading.vanished {
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    for child-theme functions.php

    function scroll_up_down_change() {
    if(is_page(1048)){
    ?>
    <script>
    (function($) {
    var element_to_observe = $('#emergency');
    var	fixedElement = $('#av_section_1 .avia_textblock div[style*="fixed"]').addClass('fixed-heading').css('z-index' , '5');
    
        element_to_observe.waypoint(function(direction) {
            if (direction == 'up') {
              fixedElement.addClass('vanished');
            }
            else {
              fixedElement.removeClass('vanished');
            }
            fixedElement.toggleClass('vanished');
        }, { offset: '80%' });
    })(jQuery);
    </script>
    <?php
    }
    }
    add_action('wp_footer', 'scroll_up_down_change', 30);

    waypoint looks for the position of the observed element ( #emergency ) – when it is at 80% of the viewport it will add a class.

    #1204841

    just for info – you can combine the waypoints script with the animate css: https://daneden.github.io/animate.css/
    you can download the css form daneden – put it in your child-theme folder css ( if not existent – create one ) – load the css via child-theme functions.php:

    // Einbinden von Animate.css
    add_action( 'wp_enqueue_scripts', 'wp_load_animate', 20 );
    function wp_load_animate() {
       wp_enqueue_style( 'animate', get_stylesheet_directory_uri().'/css/animate.css' );
    }

    see my test page from above with hinge class added
    __________________________________

    ( if you don’t like to load the whole css – you can pick out the keyframes you like to have f.e: the hinge )

    @-webkit-keyframes hinge {
      0% {
        -webkit-transform-origin: top left;
        transform-origin: top left;
        -webkit-animation-timing-function: ease-in-out;
        animation-timing-function: ease-in-out;
      }
    
      20%,
      60% {
        -webkit-transform: rotate3d(0, 0, 1, 80deg);
        transform: rotate3d(0, 0, 1, 80deg);
        -webkit-transform-origin: top left;
        transform-origin: top left;
        -webkit-animation-timing-function: ease-in-out;
        animation-timing-function: ease-in-out;
      }
    
      40%,
      80% {
        -webkit-transform: rotate3d(0, 0, 1, 60deg);
        transform: rotate3d(0, 0, 1, 60deg);
        -webkit-transform-origin: top left;
        transform-origin: top left;
        -webkit-animation-timing-function: ease-in-out;
        animation-timing-function: ease-in-out;
        opacity: 1;
      }
    
      to {
        -webkit-transform: translate3d(0, 700px, 0);
        transform: translate3d(0, 700px, 0);
        opacity: 0;
      }
    }
    
    @keyframes hinge {
      0% {
        -webkit-transform-origin: top left;
        transform-origin: top left;
        -webkit-animation-timing-function: ease-in-out;
        animation-timing-function: ease-in-out;
      }
    
      20%,
      60% {
        -webkit-transform: rotate3d(0, 0, 1, 80deg);
        transform: rotate3d(0, 0, 1, 80deg);
        -webkit-transform-origin: top left;
        transform-origin: top left;
        -webkit-animation-timing-function: ease-in-out;
        animation-timing-function: ease-in-out;
      }
    
      40%,
      80% {
        -webkit-transform: rotate3d(0, 0, 1, 60deg);
        transform: rotate3d(0, 0, 1, 60deg);
        -webkit-transform-origin: top left;
        transform-origin: top left;
        -webkit-animation-timing-function: ease-in-out;
        animation-timing-function: ease-in-out;
        opacity: 1;
      }
    
      to {
        -webkit-transform: translate3d(0, 700px, 0);
        transform: translate3d(0, 700px, 0);
        opacity: 0;
      }
    }
    
    .hinge {
      -webkit-animation-duration: 2s;
      animation-duration: 2s;
      -webkit-animation-name: hinge;
      animation-name: hinge;
    }
    • This reply was modified 4 years, 8 months ago by Guenni007.
    #1204888

    Thanks again!!

    Is this something you could live with? : https://webers-testseite.de/pureinstall/alb-testseite/

    Look to the responsvie case on narrower screens.

    This looks fine. Is this done using the code below or are they all different routes? Sorry for being a bit dim.

    • This reply was modified 4 years, 8 months ago by domchocolate.
    #1204904

    First : did you try that: https://kriesi.at/support/topic/position-fixed-div-to-become-position-unfixed-rest-at-point-on-page-scroll/#post-1204832

    what i just mentioned above is that with a custom class it would be easier to address this element.
    Now in the code there is as selector: #av_section_1 .avia_textblock div[style*="fixed"]

    with your setup and the code above and f.e:
    in addition :

    @media only screen and (max-width: 767px) {
      .page-id-1048 #av_section_1 .flex_column:nth-of-type(2) {
          margin-top: 60px !important;
      }
    }

    the responsivie case could be ok too!
    The more often I look at it, the more I can live with the fact that this fixed element slides under the texts.

    • This reply was modified 4 years, 8 months ago by Guenni007.
    #1204913

    The waypoints script is a mighty tool – and as mentioned above it is integrated in Enfold with its main parts.
    In Combination with animate.css we can create scrollbased animations like Enfold offers when elements comes into viewport.

    I change for now the animation on my test page to bounceOutRight
    The code in functions.php only get then instead of vanished : bounceOutRight. Thats all – but these animate.css are not part of Enfold.
    The opacity change from 0 to 1 and viceversa is ok too.

    #1204922

    Thanks Guenni – this looks great but I may not be able to implement it before Monday. My wife takes a dim view of me working at weekends when we have a 5 year old that needs entertaining. I’ll report back once I’ve tried (may try this evening) but it looks perfect. Thanks again

    D

    #1204930

    I completely agree with your wife. That preference should always come first.
    My children are both grown up, so I have a little more time for such activities today.
    Nevertheless, I too would prefer to go out now for a good wine and some music. ;)

    #1205068

    Sneaked in the time. It works a treat.

    Thanks so much again for your expert advice.

    D

    #1205069

    Sorry one more thing – I couldn’t get the mobile version (single column) to work where the ‘We specialise in’ goes into the top of each paragraph. How did you do that on your test site?

    #1205081

    this is only display block/none
    i inserted on the text-block an additional entry:

    @media only screen and (min-width: 768px) {
      .replaced-slogan {
          display: none;
      }
    }
    
    @media only screen and (max-width: 767px) {
      .fixed-heading {
        display: none;
      }
      
      .replaced-slogan {
      padding: 20px 20px 10px;
      background-color: #96c451;
      margin-bottom: 20px
      }
    }
    #1205082

    But as i said the other way to add this in additon to have a nice startpoint for the fixed element:

    Edit
    No the other way is much better – test on your Phone what happens.

    `@media only screen and (max-width: 767px) {
    .page-id-1048 #av_section_1 .flex_column:nth-of-type(2) {
    margin-top: 60px !important;
    }
    .fixed-heading {
    width: 85%;
    text-align:center
    }
    }`

    with your momentan solution is nice too !

    #1205198

    next way : https://webers-testseite.de/pureinstall/brodes/
    maybe this is an option too?

    #1205775

    Hi Guenni

    I like both ways – I’ll stick with the first one for now and keep the second one in reserve. Thanks again for all your help! It works great.

Viewing 16 posts - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.