Use that JQuery code from your question in customizer preview for real time update. Your transport should be set to ‘postMessage’. In your website you can add body class in function.php:
function theme_prefix_body_class( $classes ) {
if ( get_theme_mod('header_fixed', 0 ) == true ) {
$classes[] = 'fixed-header';
}
return $classes;
}
add_filter( 'body_class', 'theme_prefix_body_class' );
Related Posts:
- Passing boolean values with wp_localize_script
- Color Picker (iris) in widget – refresh when edited in Customizer
- Click link on plugin/theme page and open the contextual help on a specific tab
- Access Customizer’s DOM – jQuery
- possible to make sections in theme customizer sortable and saveable at publish button clicked?
- $wp_customize customizer_preview_init not firing inside javascript
- Hide/show customizer controls based on other settings in Customizer
- trigger(‘change’) not working
- WordPress customizer refresh screen after save
- Sorting widget control
- Validating a cloned/repeatable input (jQuery) [closed]
- WP Customizer compare and set a value via javascript
- Callback After WordPress Customizer Complete Loading
- How to call custom jQuery plugins into the customizer controls
- WP Customizer: Save a control state
- Change CSS Variable value in Theme Customizer Live Preview
- Javascript when Customizer preview is ready/refreshed?
- Remove button from page if viewed through Customizer
- Customizer add query to preview URL
- Retrieve customizer value using ajax or customizer api and print the value in theme
- How to add input file plain text and submit to publish?
- jQuery $(this) keyword
- How to enable CORS in flask
- Set selected option of select box
- jquery loop on Json data using $.each
- JavaScript console.log causes error: “Synchronous XMLHttpRequest on the main thread is deprecated…”
- How to read data From *.CSV file using javascript?
- How can I create a “Please Wait, Loading…” animation using jQuery?
- $.focus() not working
- Enqueue core jQuery in the footer?
- How to modify wp.media to get and display multiple images
- wp_mail script with jQuery post
- Hacking TinyMCE for better usability (shortcodes and html)
- Including javascript for a shortcode
- Twitter Bootstrap Use Collapse in Custom Post Type
- adding the full image path to a wordpress javascript file
- wp_head() remove redundant scripts?
- Enqueue jQuery in WordPress
- Installing jQuery plugin to wordpress theme (Incredible)
- How do I get my page to load the jQuery UI Effects library?
- How to add unique image class to WordPress
- Dropzonejs with WPCF7 [closed]
- Edit single attachment on click (WP-admin)
- How to include jQuery when no header and footer on the page
- Showing Author Information and Latest Post by author in lightbox when clicked on the name of the author
- Why isn’t jQuery 2.1 loading in the header?
- Load jQuery inside Page Template
- enqueue the scripts
- Returning content via jQuery without footers on admin pages
- wpColorPicker: How update colors on input value update?
- Getting all URLs of uploaded images using media uploader
- Reorder displayed posts with JQuery (title A-Z / last posted)
- Using an if statement in the theme customizer page
- `wp_editor()` CSS messing up the jQuery Dialog
- Ajax, Permalinks and post_thumbnail
- How to embed JS data viz in a simple WordPress website
- First Attempt at AJAX and it keeps getting Canceled. Can’t Get Results to Show
- Enque Javascript in Footer?
- Yoast SEO breaking media upload
- window.onload wont execute in wordpress
- How to return multiple arguments from AJAX callback function
- JS news ticker is not working on home page but working on other pages. How to solve this?
- jQuery function not working
- Readonly input text appears unlocked while the page is loading
- Remove swfobject.js in wp_head()
- Run JS function when JQ enqueued
- Uncaught ReferenceError: jQuery is not defined: how to fix on a sunday? [closed]
- Shortcode don’t work in custom option field, any solution?
- underscore template dynamically remove row Jquery
- Loading external jQuery files with $
- How can I create a rearrangeable list of items like OptionTree offers with the Theme Customization API?
- echo do_shortcode for Contact Form 7 from within dynamically loaded php file
- How to use wp_update_post with ajax on frontend
- including jquery
- Customizing the Jquery Calendar [closed]
- what does $options = get_option(‘test_theme’); do?
- How to make JQuery load on top of head tag before everything
- Dashboard controls have all stopped working
- $_POST empty in using new php file added to theme
- How to blur the_post_thumbnail() via blur.js (jquery)?
- What to do after a wrong RewriteRule?
- Plugin preventing media buttons from working
- How to deregister scripts all at once
- Using jQuery DataTables and yadcf
- jQuery autcomplete not working
- jQuery drop down not appearing for autocomplete/autosuggest
- jQuery dialog prints HTML-Tags under WordPress
- Add jQuery function to media button
- TypeError: $ is not a function Error using parallax effect in WordPress Template [duplicate]
- Loading custom file based on a dependant file that is also dependant on another file
- Why won’t this jQuery work in WordPress?
- Auto Sorting List Alphabetically
- Change WooCommerce Checkout Manager Datepicker to Jalali
- Custom logo manage by customizer and theme options
- jQuery append only works if I select html in admin section [closed]
- jQuery color picker function on change
- Can’t get this jQuery snippet to work with WordPress
- Javascript Loading Effect to URLs
- jQuery Add/Remove Classes Not Working
- Fire an event after Featured Image selection