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

P

pmpm

@pmpm
About
Posts
3
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Link to Anchor from another page
    P pmpm

    Dear @mariusjopen Thanks a lot! It turned out that the script didn't even apply. So now it also works without the js and I found a solution to come to the right position with an empty textfield which contains the id above the image. This works great. But only in Firefox and Chrome. In Safari it seems like the scroll-position is not identical with other browsers. Do you have any clue what the problem could be there?

    General Discussion

  • Link to Anchor from another page
    P pmpm

    @mariusjopen straight out of the youtube tutorial:

    <script>
        
        jQuery(document).on( 'click', 'a[href^="#"]', function(e){
            e.preventDefault();
            var hash = jQuery(this).attr('href');
            var el = jQuery(hash);
            var top = el.offset().top;
            jQuery('html, body').animate({
                scrollTop: top
            }, 1200, 'swing',
                function() {
                    window.location.hash = hash;
                }
            );
        } );
        
        window.laytheme.on('newpageshown', function(){
            var hash = window.location.hash; 
            var el = jQuery(hash);
            if(el.length > 0) {
                var top = el.offset().top;
                window.scroll(0, top);        
            }
        });
        
    </script>
    
    General Discussion

  • Link to Anchor from another page
    P pmpm

    Hey @arminunruh
    This is great! Just one question. How can I add an offset to this, so it scrolls to the image but always has a gap of 80px above the image?
    I hope you know what I mean. The problem is that it cuts off the image at the top https://fabienne-fischer.ch/works/#hello
    Thanks a lot!

    General Discussion
  • Login

  • Don't have an account? Register

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