WPIntell

Source evidence

Javascript errors on pages that don't need plugin

Infinite Scroll and Load More Ajax Pagination · support · 2016-01-26T22:48:00+00:00

complaintsentiment
mediumseverity
0.8relevance
3replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

4 / 23 rows with source links

17.4% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

19 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
chardp unresolved
I am getting continuous javascript errors on pages where I do not need this plugin to function (ie pages where the item selector doesn’t exist.) The error is the following: jquery.infiniteload.js?ver=4.3.1:111 Uncaught TypeError: Cannot read property ‘top’ of undefined I imagine you just add a check to make sure the selectors exist or something. https://wordpress.org/plugins/infinite-scroll-and-load-more-ajax-pagination/ Agreed! This is happening to me too — please add a fix for this in the next update. I solve this, changing the file that contains the function to the enqueue scripts in the front-end. /* Add javascript and css for front end */ function pix_enqueue_script() { // I PUT THIS CONDITION, IF PAGE IS BLOG (page slug or id), execute the script if(is_page('blog')) { $enable_infinite_load=pix_get_option('enable_infinite_load'); if(!empty($enable_infinite_load)){ wp_enqueue_style( 'pix-infiniteload', INFINITE_LOAD_URL . '/css/infiniteload.css' ); wp_enqueue_script( 'pix-infiniteload-lib', INFINITE_LOAD_URL . '/js/jquery.infiniteload.js', array('jquery'),false,true); wp_enqueue_script( 'pix-infiniteload', INFINITE_LOAD_URL . '/js/infiniteload.js', array('jquery','pix-infiniteload-lib'),false,true); wp_localize_script( 'pix-infiniteload', 'pix_infiniteload', array('navSelector'=>pix_get_option('navigation_selector'),'contentSelector'=>pix_get_option('content_selector'),'nextSelector'=>pix_get_option('next_selector'),'itemSelector'=>pix_get_option('item_selector'),'paginationType'=>pix_get_option('pagination_type'),'loadingImage'=>pix_get_option('loading_image'),'loadingButtonLabel'=>pix_get_option('button_label'),'loadingButtonClass'=>pix_get_option('button_class'),'loadingFinishedText'=>pix_get_option('finished_msg')) ); } } } add_action( 'wp_enqueue_scripts', 'pix_enqueue_script' ); hi, i solve this problem with this code: function pix_enqueue_script() { if(is_home()) { $enable_infinite_load=pix_get_option('enable_infinite_load'); if(!empty($enable_infinite_load)){ wp_enqueue_style( 'pix-infiniteload', INFINITE_LOAD_URL . '/css/infiniteload.css' ); wp_enqueue_script( 'pix-infiniteload-lib', INFINITE_LOAD_URL . '/js/jquery.infiniteload.js', array('jquery'),false,true); wp_enqueue_script( 'pix-infiniteload', INFINITE_LOAD_URL . '/js/infiniteload.js', array('jquery','pix-infiniteload-lib'),false,true); wp_localize_script( 'pix-infiniteload', 'pix_infiniteload', array('navSelector'=>pix_get_option('navigation_selector'),'contentSelector'=>pix_get_option('content_selector'),'nextSelector'=>pix_get_option('next_selector'),'itemSelector'=>pix_get_option('item_selector'),'paginationType'=>pix_get_option('pagination_type'),'loadingImage'=>pix_get_option('loading_image'),'loadingButtonLabel'=>pix_get_option('button_label'),'loadingButtonClass'=>pix_get_option('button_class'),'loadingFinishedText'=>pix_get_option('finished_msg')) ); } } } add_action( 'wp_enqueue_scripts', 'pix_enqueue_script' ); I add the condition in this function. I’m not use this code ‘is_page(‘blog’)’. but this ‘is_home()’. I use this codex page for resolve the problem. http://codex.wordpress.org/Conditional_Tags If u need to add more page in your condition, this is the code: if(is_home() || is_front_page() || is_sigle() || ETC.... ) {}

Comments

3 shown
LS 2016-03-12T17:47:00+00:00

Agreed! This is happening to me too — please add a fix for this in the next update.

matheuskps 2016-03-17T15:51:00+00:00

I solve this, changing the file that contains the function to the enqueue scripts in the front-end. /* Add javascript and css for front end */ function pix_enqueue_script() { // I PUT THIS CONDITION, IF PAGE IS BLOG (page slug or id), execute the script if(is_page('blog')) { $enable_infinite_load=pix_get_option('enable_infinite_load'); if(!empty($enable_infinite_load)){ wp_enqueue_style( 'pix-infiniteload', INFINITE_LOAD_URL . '/css/infiniteload.css' ); wp_enqueue_script( 'pix-infiniteload-lib', INFINITE_LOAD_URL . '/js/jquery.infiniteload.js', array('jquery'),false,true); wp_enqueue_script( 'pix-infiniteload', INFINITE_LOAD_URL . '/js/infiniteload.js', array('jquery','pix-infiniteload-lib'),false,true); wp_localize_script( 'pix-infiniteload', 'pix_infiniteload', array('navSelector'=>pix_get_option('navigation_selector'),'contentSelector'=>pix_get_option('content_selector'),'nextSelector'=>pix_get_option('next_selector'),'itemSelector'=>pix_get_option('item_selector'),'paginationType'=>pix_get_option('pagination_type'),'loadingImage'=>pix_get_option('loading_image'),'loadingButtonLabel'=>pix_get_option('button_label'),'loadingButtonClass'=>pix_get_option('button_class'),'loadingFinishedText'=>pix_get_option('finished_msg')) ); } } } add_action( 'wp_enqueue_scripts', 'pix_enqueue_script' );

danielecina 2016-05-13T21:17:00+00:00

hi, i solve this problem with this code: function pix_enqueue_script() { if(is_home()) { $enable_infinite_load=pix_get_option('enable_infinite_load'); if(!empty($enable_infinite_load)){ wp_enqueue_style( 'pix-infiniteload', INFINITE_LOAD_URL . '/css/infiniteload.css' ); wp_enqueue_script( 'pix-infiniteload-lib', INFINITE_LOAD_URL . '/js/jquery.infiniteload.js', array('jquery'),false,true); wp_enqueue_script( 'pix-infiniteload', INFINITE_LOAD_URL . '/js/infiniteload.js', array('jquery','pix-infiniteload-lib'),false,true); wp_localize_script( 'pix-infiniteload', 'pix_infiniteload', array('navSelector'=>pix_get_option('navigation_selector'),'contentSelector'=>pix_get_option('content_selector'),'nextSelector'=>pix_get_option('next_selector'),'itemSelector'=>pix_get_option('item_selector'),'paginationType'=>pix_get_option('pagination_type'),'loadingImage'=>pix_get_option('loading_image'),'loadingButtonLabel'=>pix_get_option('button_label'),'loadingButtonClass'=>pix_get_option('button_class'),'loadingFinishedText'=>pix_get_option('finished_msg')) ); } } } add_action( 'wp_enqueue_scripts', 'pix_enqueue_script' ); I add the condition in this function. I’m not use this code ‘is_page(‘blog’)’. but this ‘is_home()’. I use this codex page for resolve the problem. http://codex.wordpress.org/Conditional_Tags If u need to add more page in your condition, this is the code: if(is_home() || is_front_page() || is_sigle() || ETC.... ) {}