Put it in an if clause to only load on front page:
if (is_front_page()){ // you could also try is_home()
//or is_page($the_id_of_home_page = 555) If you know the id of the home page
wp_register_script('java1', get_template_directory_uri() . '/js/cr-scroll.js', array( 'jquery' ));
wp_enqueue_script( 'java1' );
}
or remove it on a specific page:
function remove_scroll_js(){
if (is_page($the_id_of_that_page_lets_say = 1001)){
wp_dequeue_script( 'java1' );
wp_deregister_script( 'java1' );
}
}
add_action( 'wp_enqueue_scripts', 'remove_scroll_js' );
Related Posts:
- How to round to at most 2 decimal places, if necessary?
- Invariant Violation: Objects are not valid as a React child
- Angular: conditional class with *ngClass
- How to round to at most 2 decimal places, if necessary?
- How can I access and process nested objects, arrays or JSON?
- Cannot set property ‘innerHTML’ of null
- How to replace innerHTML of a div using jQuery?
- Cannot read property ‘addEventListener’ of null
- TypeError: Converting circular structure to JSON in nodejs
- How can I refresh a page with jQuery?
- Getting Error “Form submission canceled because the form is not connected”
- Heroku: “No default language could be detected for this app” error thrown for node app
- Pure JavaScript Send POST Data Without a Form
- Remove duplicate values from JS array
- Add days to JavaScript Date
- ajax jquery simple get request
- How to resolve TypeError: Cannot convert undefined or null to object
- What is prevState in ReactJS? [duplicate]
- React with ES7: Uncaught TypeError: Cannot read property ‘state’ of undefined
- What’s the source of Error: getaddrinfo EAI_AGAIN?
- React – TypeError: Cannot read property ‘props’ of undefined
- How to open a local disk file with JavaScript?
- Give a value to an ng-model=”searchText” input based on list item clicked in Angular JS
- Difference between textContent vs innerText
- How can I guarantee that my enums definition doesn’t change in JavaScript?
- How to write an inline IF statement in JavaScript?
- ‘setInterval’ vs ‘setTimeout’
- Convert string to Title Case with JavaScript
- How to remove item from array by value?
- SecurityError: Blocked a frame with origin from accessing a cross-origin frame
- React Error: Target Container is not a DOM Element
- Google Conversions Not Working – Script Won’t Load
- Uncaught TypeError: Cannot read property ‘top’ of undefined
- Is JavaScript supported in an email message?
- Basic Ajax send/receive with node.js
- How do I check whether an array contains a string in TypeScript?
- using jQuery $(this).addClass not working, simple code not working
- onClick to get the ID of the clicked button
- HTML text input allow only numeric input
- How to change the buttons text using javascript
- Can you write nested functions in JavaScript?
- How to use jQuery in chrome extension?
- How do I use this JavaScript variable in HTML?
- How to check if a variable is not null?
- Crop the image using JavaScript
- What is the best way to remove a table row with jQuery?
- Adjust width and height of iframe to fit with content in it
- document.getElementbyId() returning null
- Seeding the random number generator in Javascript
- Bootstrap popover is not working
- Sort array of objects by single key with date value
- How to add a tooltip to an svg graphic?
- How do I make a discord bot join a voice channel?
- How to display raw JSON data on a HTML page
- Sorting object property by values
- jQuery if Element has an ID?
- Get name of object or class
- Complex JSON nesting of objects and arrays
- jQuery – Increase the value of a counter when a button is clicked
- Insert a string at a specific index
- Getting a random value from a JavaScript array
- Moment Js UTC to Local Time
- Get the size of the screen, current web page and browser window
- How to reload/refresh jQuery dataTable?
- AngularJS POST Fails: Response for preflight has invalid HTTP status code 404
- Getting “Cannot call a class as a function” in my React Project
- Separating html and JavaScript in Flask [duplicate]
- How to read and write into file using JavaScript?
- How to use aria-expanded=”true” to change a css property
- How do I concatenate a string with a variable?
- setTimeout callback argument
- Nonce retrieved from the REST API is invalid and different from nonce generated in wp_localize_script
- wp.customize.bind ready event not fired
- What does wp-list.js do?
- How to combine javascript files without plugins?
- conditional layout based on if Innerblocks is not empty
- WordPress Errors? Update Failed! data.min.js
- Load script after block is inserted
- Only loads on the contact template page
- Min And Max Date With Date Format In Elementor Form Not Working
- Strange gibberish JavaScript in Editor – site hacked?
- Building a slide down search box in wordpress
- javascript conflict
- How can I use CKEditor with WordPress and let clients edit the content?
- esc_js() breaks unicode sequences by removing the slash ‘\’ character
- Video script issue, JavaScript attribute remains ‘undefined’
- Gutenberg getBlockIndex in save() function
- Widgets and Post/Page edit/new blank, console errors only, no server errors
- Why does a on Comment edit page submit the page?
- Javascript asset not enqueuing with the rest
- Taxonomy Template displaying different color post tag js
- Change (replace) tags to tags
- Is there an option to execute javascript file only on plugin deactivation
- Why doesn’t my JS script load?
- Javascript Injection on my WordPress Site
- WordPress Gutenberg Ajax request
- Show sections based on a control in WordPress Customizer using JS API
- Adding javascript script to header via functions.php
- how to refresh page after user logout with ‘wp_logout_url’?
- Securing Contact Form 7 [closed]