Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #283607

    Hi guys i am trying to ad anchor links to a page, the thing is that i am using one color section with a background image containing all the content, so i cant use different color sections to use the anchor link described here http://kriesi.at/documentation/enfold/add-anchors-to-your-page-for-single-page-navigation/
    So how can i link to specific text block, or element other than color section?
    http://abolengo.com.ar/?page_id=4185

    #283662

    Hi smorrone!

    Please turn on custom CSS field for ALB elements – http://kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/
    then add a custom class to your textbox, say “anchor-text”. Then add following code to functions.php file in Appearance > Editor

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('.anchor-text').attr('id', 'anchor-text');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    then you should be able to target the textbox using #anchor-text ID

    Regards,
    Yigit

    #283711

    Yigit i followed the instructions and is not working. Also i have to target four different anchors, how i identify each one of them?
    Can you check it please?

    #283712

    Hey!

    Sorry i made a mistake in functions.php file of your child theme. Can you please connect via FTP and undo the changes i made? I have added the code i posted here – https://kriesi.at/support/topic/links-to-a-different-part-of-the-same-page/#post-283662

    Best regards,
    Yigit

    #283731

    Hey the site went off line!
    Yes i can do that via ftp,
    i replace the code with this one?

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(‘.anchor-text’).attr(‘id’, ‘anchor-text’);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘add_custom_script’);

    #283753

    ok, done this put the site on line again… so far so good
    i have to target four different anchors, how i identify each one of them?

    #283853

    Hey!

    I am so sorry about that! Please add folllowing code and customise the class names for each section as following

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){
    if ( jQuery("div").hasClass(".custom-class-one") ) {
      jQuery(".custom-class-one").attr('id','custom-class-one') };
    if ( jQuery("div").hasClass(".custom-class-two") ) {
      jQuery(".custom-class-two").attr('id','custom-class-two') };
    if ( jQuery("div").hasClass(".custom-class-three") ) {
      jQuery(".custom-class-three").attr('id','custom-class-three') };
    if ( jQuery("div").hasClass(".custom-class-four") ) {
      jQuery(".custom-class-four").attr('id','custom-class-four') };
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    and please try not to use numbers as ID’s.

    Cheers!
    Yigit

    #283863

    Thanks Yigit!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Links to a different part of the same page’ is closed to new replies.