JQUERY

CORS policy: No ‘Access-Control-Allow-Origin’

Font from origin domain.dev has been blocked… (CORS and browsersync) If you are getting issue fonts are blocked in web client CORS then below code will help you. Use the code in .htaccess file and problem will be resolved 🙂 # Allow access from all domains for webfonts. <IfModule mod_headers.c> <FilesMatch “\.(ttf|ttc|otf|eot|woff|woff2|font.css|css)$”> Header set Access-Control-Allow-Origin “*” …

CORS policy: No ‘Access-Control-Allow-Origin’ Read More »

jQuery Sticky Navigation Effect

To create a sticky effect on the main navigation bar above when a user scrolls passed beyond it. Use below jquery code jQuery(function(){ var menuOffset = jQuery(‘#site-navigation’)[0].offsetTop; jQuery(document).bind(‘ready scroll’,function() { var docScroll = jQuery(document).scrollTop(); if(docScroll >= menuOffset) { jQuery(‘#site-navigation’).addClass(‘fixed’).css(‘width’,jQuery(‘#masthead’).width()); } else { jQuery(‘#site-navigation’).removeClass(‘fixed’).removeAttr(“width”); } }); }); Fairly basic jQuery code. It will add a class …

jQuery Sticky Navigation Effect Read More »

Javascript Confirm Delete

How to use a javascript confirm box to ask the user if they want to delete <script> function confirmDelete(deleleteUrl) { if (confirm(“Are you sure you want to delete”)) { document.location = deleleteUrl; } } </script> <a href=”javascript:confirmDelete(‘delete.php?id=1’)”>Delete</a> Another way <a href=”delete.php?id=1″ onclick=”return confirm(‘Are you sure you want to delete?’)”>Delete</a>