Forums › Forums › Search & Filter Pro › Invisible Ajax results
Tagged: ajax, hidden results, invisible
- This topic has 15 replies, 2 voices, and was last updated 9 years, 6 months ago by Ross.
-
Anonymous(Private) April 16, 2015 at 3:48 pm #15231
Hi guys,
everything is set up fine, when loading my page it’s all right.
I’m using shortcode integration.But when loading results with Ajax (after a search, or ‘next page’ by example) all my content is invisible..
It is ‘present’ on the page, in the code, even the links are activated, but nothing is shown ! As if all my post were 0% opacity
It works well without using Ajax to display results.
Any idea ?
Ross Moderator(Private) April 16, 2015 at 4:05 pm #15232Strange!
S&F will fade out the area for results when it gets new content then fade back in…
So you might have a javascript problem (check your JS console using something like firebug)…
Let me know what you find.
Thanks
Anonymous(Private) April 16, 2015 at 5:59 pm #15247I’ve resolved the issue by adjusting CSS of results.php : it was calling some function of the theme to define CSS classes, and I think it was not working when ajaxed.
However I DO have a pb of JS : as below, on page load, no pb : some JS is called and create a nice masonry grid.
But when ajaxing the results, the grid is not looking good. I’ve checked console, but I don’t know what to look at.. One thing is true : when I disable JS, the load page has the same mess, so definitely some JS is not loading in ajax results.
Any idea ? 😀
Ross Moderator(Private) April 16, 2015 at 7:20 pm #15254Take a look at the first question in the FAQs – http://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/
Basically you need to reinitialise the JS that controls your layout once the ajax request is complete.
Thanks
Anonymous(Private) April 19, 2015 at 3:15 pm #15381Thanks Ross,
indeed it make sense.
However where should I put this code ?
When I insert it I have a PHP error (I’ve tried in my functions.php and on the results.php template)
$(".searchandfilter").on("sf:ajaxstart",function(){ console.log("ajax start"); }); $(".searchandfilter").on("sf:ajaxfinish",function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again });
Thank you for your help
Ross Moderator(Private) April 21, 2015 at 9:19 am #15511Hey Stephane
The code above would go somewhere in your theme, likely in the main JavaScript file it uses (not functions.php).
The JS you need to re-load will be something specific to your theme – it could have any name so your best bet might be to get in touch with the theme authors and ask how to reinitialise the JS for those specific layouts or get someone to help you dig around the code to find the functions.
Thanks
Anonymous(Private) May 1, 2015 at 9:04 pm #16420Hey Ross,
theme developers were not very helpful :/
I found in my parent theme functins.php the following :
#-----------------------------------------------------------------# # Register/Enqueue JS #-----------------------------------------------------------------# $options = get_option('salient'); function nectar_register_js() { global $options; if (!is_admin()) { // Register wp_register_script('modernizer', get_template_directory_uri() . '/js/modernizr.js', 'jquery', '2.6.2'); wp_register_script('respond', get_template_directory_uri() . '/js/respond.js', 'jquery', '1.1', TRUE); wp_register_script('superfish', get_template_directory_uri() . '/js/superfish.js', 'jquery', '1.4.8', TRUE); wp_register_script('respond', get_template_directory_uri() . '/js/respond.js', 'jquery', '1.1',TRUE); wp_register_script('orbit', get_template_directory_uri() . '/js/orbit.js', 'jquery', '1.4', TRUE); wp_register_script('nicescroll', get_template_directory_uri() . '/js/nicescroll.js', 'jquery', '3.5.4' ,TRUE); wp_register_script('sticky', get_template_directory_uri() . '/js/sticky.js', 'jquery', '1.0', TRUE); wp_register_script('nectar_prettyPhoto', get_template_directory_uri() . '/js/prettyPhoto.js', 'jquery', '5.5.4', TRUE); wp_register_script('nectar_parallax', get_template_directory_uri() . '/js/parallax.js', 'jquery', '1.0', TRUE); wp_register_script('isotope', get_template_directory_uri() . '/js/isotope.min.js', 'jquery', '2.0' ,TRUE); wp_register_script('nectarSlider', get_template_directory_uri() . '/js/nectar-slider.js', 'jquery', '5.5.4', TRUE); wp_register_script('iosSlider', get_template_directory_uri() . '/js/jquery.iosslider.min.js', 'jquery', '5.5.4', TRUE); wp_register_script('ajaxify', get_template_directory_uri() . '/js/ajaxify.js', 'jquery', '5.5.4', TRUE); if ( floatval(get_bloginfo('version')) < "3.6" ) { wp_register_script('jplayer', get_template_directory_uri() . '/js/jplayer.min.js', 'jquery', '2.1', TRUE); } wp_register_script('nectarFrontend', get_template_directory_uri() . '/js/init.js', array('jquery', 'superfish'), '5.5.4', TRUE); // Dequeue wp_dequeue_script( 'prettyPhoto' ); // Enqueue wp_enqueue_script('jquery'); wp_enqueue_script('modernizer'); wp_enqueue_script('superfish'); wp_enqueue_script('respond'); if(!empty($options['smooth-scrolling']) && $options['smooth-scrolling'] == '1') wp_enqueue_script('nicescroll'); wp_enqueue_script('sticky'); wp_enqueue_script('nectar_prettyPhoto'); wp_enqueue_script('isotope'); if ( floatval(get_bloginfo('version')) < "3.6" ) { wp_enqueue_script('jplayer'); } wp_enqueue_script('nectarFrontend'); $transition_method = (!empty($options['transition-method'])) ? $options['transition-method'] : 'ajax'; if(!empty($options['ajax-page-loading']) && $options['ajax-page-loading'] == '1' && $transition_method == 'ajax') { wp_enqueue_script('nectarSlider'); wp_enqueue_script('ajaxify'); } } } add_action('wp_enqueue_scripts', 'nectar_register_js'); function nectar_page_specific_js() { global $post; global $options; if(!is_object($post)) $post = (object) array('post_content'=>' ', 'ID' => ' '); $template_name = get_post_meta( $post->ID, '_wp_page_template', true ); //home if ( is_page_template('template-home-1.php') || $template_name == 'salient/template-home-1.php' || is_page_template('template-home-2.php') || $template_name == 'salient/template-home-2.php' || is_page_template('template-home-3.php') || $template_name == 'salient/template-home-3.php' || is_page_template('template-home-4.php') || $template_name == 'salient/template-home-4.php') { wp_enqueue_script('orbit'); } ////infinite scroll $portfolio_extra_content = get_post_meta($post->ID, '_nectar_portfolio_extra_content', true); $posttype = get_post_type($post); if(stripos( $post->post_content, '[nectar_blog') !== FALSE || stripos( $portfolio_extra_content, '[nectar_blog') !== FALSE || stripos( $post->post_content, 'pagination_type="infinite_scroll"') !== FALSE || stripos( $portfolio_extra_content, 'pagination_type="infinite_scroll"') !== FALSE || (!empty($options['blog_pagination_type']) && $options['blog_pagination_type'] == 'infinite_scroll') || (!empty($options['portfolio_pagination_type']) && $options['portfolio_pagination_type'] == 'infinite_scroll') || (((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_tag())) && ( $posttype == 'post') && (!is_singular())) ) { wp_register_script('infinite_scroll', get_template_directory_uri() . '/js/infinitescroll.js', array('jquery'), '1.0', TRUE); wp_enqueue_script('infinite_scroll'); if ( floatval(get_bloginfo('version')) >= "3.6" ) { wp_enqueue_script('wp-mediaelement'); wp_enqueue_style('wp-mediaelement'); } if (class_exists('WPBakeryVisualComposerAbstract') && defined( 'SALIENT_VC_ACTIVE')) { wp_register_script('progressCircle', vc_asset_url('lib/progress-circle/ProgressCircle.js')); wp_register_script('vc_pie', vc_asset_url('lib/vc_chart/jquery.vc_chart.js'), array('jquery', 'progressCircle')); wp_enqueue_script('vc_pie'); } } //nectarSlider mediaElement if(stripos( $post->post_content, '[nectar_slider') !== FALSE || stripos( $portfolio_extra_content, '[nectar_slider') !== FALSE || stripos($post->post_content, '[vc_gallery type="nectarslider_style"') !== FALSE || stripos( $portfolio_extra_content, '[vc_gallery type="nectarslider_style"') !== FALSE) { wp_enqueue_script('nectarSlider'); } //comments if ( is_singular() && comments_open() && get_option('thread_comments') ) wp_enqueue_script('comment-reply'); } add_action('wp_enqueue_scripts', 'nectar_page_specific_js'); //Remove wooCommerce prettyPhoto global $woocommerce; if($woocommerce) { function removeWooPrettyPhoto(){ wp_dequeue_style( 'woocommerce_prettyPhoto_css' ); wp_dequeue_script( 'prettyPhoto-init' ); wp_dequeue_script( 'prettyPhoto' ); } add_action( 'wp_enqueue_scripts', 'removeWooPrettyPhoto', 99 ); }
Is there anything to do with this ?
Thanks !!
-
AuthorPosts