Styling adjustments…

This topic contains 17 replies, has 2 voices, and was last updated by  Anonymous 7 years, 9 months ago.

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #10301

    Anonymous

    Just a quick one..

    Thank you for the help yesterday, I’ve got it mostly working correctly – it’s mostly styling options at the moment.

    1: Is it possible (without manually changing the code on your plugin) to have the javascript that fires on scroll to keep the search results location to be disabled?

    2: is it possible (without manually changing the code on your plugin) to remove the ‘no results’ section from even showing? Or even better… have clicking the ‘no results’ section do the same job as closing the search?

    Thanks in advance!

    #10302
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    1. By “to keep the search results location to be disabled” do you mean like to keep the results position fixed in one position and not be able to scroll away from it (even when reaching results bottom)? I’m not sure if this is possible, as the scrolling event automatically propagates back to the browser.

    2. It’s possible by adding an additional script to the site footer. Put this to the footer.php file in your theme directory, right before the closing body tag:

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #10303

    Anonymous

    Amazing, thankyou.

    Ref the first query, the issue is that because it takes so long to reconnect to the top of the page (if you scoll down, it gets left behind and after a second it catches up). I kind of just want it to be fixed, with it scrolling with my header. Does that make sense?

    #10304
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I see what you mean now.

    The delay is added on purpose, because on scrolling the results list (absolute position) needs to be re-positioned to the search bar (static position), and the only way to do that is by moving it with javascript – however doing that X times per second when the scrolling triggers creates a massive performance issue for the browser, so it’s solved by delaying the calculation after the scrolling is stopped.

    In your case however the header is “moving” with the page, but it’s on a fixed position, so I think forcing a fixed position on the results might solve this issue. Try this custom CSS:

    div.ajaxsearchpro[id*=ajaxsearchprores1_].vertical {
        position: fixed !important;
        top: 120px !important;
    }

    This will force the top position of the results to 120pixels from the viewport at all times. I’m not sure if it works in all cases though.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #10305

    Anonymous

    Almost perfect!

    What do I do when my header changes size on scroll though? Any properties I add by jQuery are overwritten by the plugin…

    #10306

    Anonymous

    Maybe if it was attached to the search box? I’ve tried the other option but if there was an element I could force it to be connected to so that as the header naturally changed height it would be pushed down?

    Maybe that’s too big of a change? I really appreciate all this help you are giving.

    #10307
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    This is only solveable by javascript only, as CSS cannot detect the scrolling.

    I would try this script something like this:

    jQuery(function($) {
      $(window).scroll(function(){
        if ($(this).scrollTop() > 10) {
          $('#ajaxsearchprores1_1').addClass('scrolled_top');
        } else {
          $('#ajaxsearchprores1_1').removeClass('scrolled_top');
        }
      });
    });

    This will check the scroll position and add a class called “scrolled_top” to the result element if the scroll is greater than 10.

    Then instead of the previous CSS, use these two:

    div.ajaxsearchpro[id*=ajaxsearchprores1_].vertical {
        position: fixed !important;
        top: 120px !important;
    }
    
    div.ajaxsearchpro[id*=ajaxsearchprores1_].vertical.scrolled_top {
        position: fixed !important;
        top: 90px !important;
    }

    The script will swap the scrolled_top class on/off, and in CSS the top is specified differently for each class.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #10308

    Anonymous

    I think I just solved it! I used the ‘push content’ rather than ‘hover’ adding some custom styling, AND used jquery to detatch the results and add them after my search object, so it moves with the content now 🙂

    One very teeeeeny last thing… Is it possible to trigger the ‘left’ styling on page resize? It adjusts when I scroll but it would be amazing if it adjusted on resize!

    #10309
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    That’s actually a pretty clever solution. The side effect of moving a DOM node is that the events attached to it (resize namely) will no longer fire. However you can quickly fix that with this script:

    jQuery(function($) {
      $(window).on('scroll resize', function(){
          $('#ajaxsearchprores1_1').css('left', $('#ajaxsearchpro1_1').offset().left);
      });
    });
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #10314

    Anonymous

    You are a genius, that fixed it.

    Thank you so much for all your effort. I wonder if this is something that a future plugin may fix but do you know of any way to have the search results page (using the “s=” info) bring all the searches into view from across the network? It’s great the way it is on the site, but I wonder if it’s possible to achieve such a thing?

    You’ve been the most helpful plugin author I’ve dealt with so thank you again.

    #10317
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    You are very welcome and thank you for your kind words 🙂

    Actually, there is an override function implemented, which might be capable of showing cross-network results as well, if the search redirection is triggered from the ajax search pro search form. I’m not sure if it will work, but it’s worth a try. Please check this short documentation on how to achieve it: https://goo.gl/eEh0FX

    Basically, you need to enable the override like so: https://i.imgur.com/buQgnUD.png

    After that, if the you enter a search phrase and hit enter via the plugin search form, the search results page will display results from across the network as well. Let’s hope it works.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #10319

    Anonymous

    SO CLOSE!

    It works, only it doesn’t bring across the featured image, and it appends the link with the current domain, so even though a blog that exists on the main ‘olddownestate’ domain is pulled though onto a search on the ‘weddings.oldownestate’ domain for instance, the link for it is prepended with ‘weddings.’

    Any ideas why that might be?

    Don’t worry if its a a complicated fix – you’ve helped enough.

    #10320
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I think I was able to fix the permalink issue, at least a part of it. I remember this was a problem a long time before, because as wordpress gets the posts, it automatically corrects the URL, so it must be re-corrected. When I re-worked version 4.9.0 I changed the method of generating these urls, and it looks like it was not working properly.

    Since you had a plugin editor installed, I’ve added one extra line to the plugin functions.php file to try to fix this issue. The results won’t be exactly the same as the one in the search bar, but the ones from the other site should display the correct URL now. (at least I hope)

    I’m going to investigate this further for the upcoming release.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #10321

    Anonymous

    Brilliant 🙂

    I’m going to do a bit of digging to see if i can adjust you plugin to bring across a featured image if one exists – if I find a way, would you like me to share it with you, or is it theme specific?

    #10322
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I’ve already looked into that, haven’t found any possibility yet.

    The problem is that the cross-site result post ID is set to a fake ID = -10, because WordPress does not support getting posts and post information from across the network without swapping blog ids. Setting a fake ID will prevent it from trying to get the post again with the incorrect information.

    I initially tried to solve it by somehow storing the featured image within the post object, but it’s every time parsed when the posts are printed. A possible solution would require to change both the search plugin code and the theme code as well. This is not possible to solve with additional filters unfortunately.

    In my honest opinion it’s not worth bothering with, a final solution might take way too much time.

    However if you find anything, let me know, and I will implement it to the upcoming version 🙂

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.