Defer parsing of javascript to improve performance in wordpress

Nothing for introduction, hehe! A very small snippet which will help you to defer parsing all javascript files except jquery in wordpress. Here is the code: This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters <?php function defer_parsing_of_js ( $url ) { if ( FALSE === strpos( $url, '.js' ) ) return $url; if ( strpos( $url, 'jquery.js' ) ) return $url; return "$url' defer "; } add_filter( 'clean_url', 'defer_parsing_of_js', […]

Continue Reading

You may also like

A very simple jQuery slideshow – jSlider

Guys, this is a very simple jQuery slideshow, jSlider. Nothing special in naming, I just used a follower’s convention. This plugins have some configuration options. Let’s look at the code. We just need one block element to implement the slideshow. In here we just need to configure some options. Among those, images field are required to put the images path. Also for caption, we may have title, some text and url to redirect on. Remember, we can’t put text/title/url for only one image, we need to put for all. In that case, if we don’t need we can use “” […]

Continue Reading

You may also like

BeautyMenu: A simple jQuery drop down menu plugin

Hey Folks, this is a very simple one level drop down menu plugin for you. Usage of this plugin is very simple. This is version 1. In next version I will make it for multi-level menu items. You can check demo before jump into the code. Now, it’s time to dive into the codes. In section, write the following code: Here, the css is for styling the menu. I also used two plugins – hoverIntent and easing. In section – Home About First Submenu Second Submenu Third Submenu Fourth Submenu Fifth Submenu Services First Submenu Second Submenu Third Submenu Portfolio […]

Continue Reading

You may also like

Change input type text to password type onclick – JQuery

Sometimes we need to change input type text to password type when user click on it. It should like more attractive. This is very simple. Here is the code for jQuery, just set a class name e.g. pw for that input field: $(‘input.pw’).each(function() { var val = $(this).attr(‘value’); if(val != ”) { $(this).focus(function() { var newVal = $(this).val(); if(newVal == val) $(this).val(”); $(this)[0].type = ‘password’; }); $(this).blur(function() { var newVal = $(this).val(); if(newVal == ”) { $(this).val(val); $(this)[0].type = ‘text’; } }); } });

Continue Reading

You may also like

Fix png issue for jQuery fadeIn()/fadeOut() effect IE7

When we use jQuery fadeIn() or faeOut() function with transparent png image, in IE7 we get a weird borer around it. There are many solutions for it, but we cant say that all of those are okay to everyone. This one works for me and some other guys. Call the following function in document load. function pngFixForIE() { var i; for (i in document.images) { if (document.images[i].src) { var imgSrc = document.images[i].src; if (imgSrc.substr(imgSrc.length-4) === ‘.png’ || imgSrc.substr(imgSrc.length-4) === ‘.PNG’) { document.images[i].style.filter = “progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=’true’,sizingMethod=’crop’,src='” + imgSrc + “‘)”; } } } }

Continue Reading

You may also like

A very simple popup plugin

This is a very simple popup plugin with jQuery. As I am a newbie, so this is for newbies. Hope it can reduce their pressure. Special thanks goes to: Anjan Bhowmik Da Adrián Mato Gondelle HTML Code: [html] Show 1st popup | Show 2nd popup 1st Popup Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla adipiscing condimentum augue, ac accumsan turpis tempus et. Proin vestibulum nibh eget diam tristique dapibus. Sed in lacus id erat ullamcorper scelerisque id accumsan lectus. In feugiat nisl molestie mauris vestibulum sed bibendum elit molestie. Phasellus porta neque nec odio posuere tempor eu a […]

Continue Reading

You may also like

An easy tooltip plugin tutorial

This is a simple tooltip plugin. You have some parameter that you can use but not mandatory. This is very simple. Not a hot-&-sexy tooltip but you can work with it. Lets check the codes. HTML Code: [html] What is this?Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Open InfoSorry! You are not allowed to see this info. Please verify your username and […]

Continue Reading

You may also like

Create a dynamic image gallery using ajax, jquery and php (XML also)

This is a tutorial to create a dynamic image gallery using jQuery ajax and php mainly. To reduce burden, I added a normal script to read directory. In gallery.php file it will read the directory and will generate a xml file which will be thrown directly to the index file (actually ajax in index file will request to execute this file and read the generated the XML formatted data). A lightbox plugin is also used in this script. Let’s have a look: HTML: Portfolio CSS: {code type=css} *{margin:0; padding:0;outline:none} .clr{clear:both;} a{text-decoration:none;} @font-face{src:url(‘../fonts/Agency_FB.ttf’);font-family:agency;} body{font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000} ul{list-style-type:none;} h1, h2, […]

Continue Reading

You may also like

Make image vertically centered align within a div and don’t let user save the picture easily

This is a very easy tutorial to set an image vertically centered within a div. Simple jQuery codes are used here. There is a also a nice option added that won’t let your user save the image easily. Please look at the code: [html] .resize{ width:105px; height:100px; background-position:center; border:1px solid #000000; margin:20px auto; background-repeat:no-repeat; } $(document).ready(function() { $(‘.resize’).each(function() { var src = $(this).find(‘img’).attr(‘src’); $(this).find(‘img’).attr(‘src’, ‘t.png’).css({‘width’:’100%’, ‘height’:’100%’}); $(this).css({‘backgroundImage’: ‘url(‘+src+’)’}); }); }); [/html] Download Link

Continue Reading

You may also like

Create Simple Jquery Right Click Cross browser Vertical Menu

Here is the code: [html] #rightclickarea{width:500px; margin:0 auto; height:300px; border:1px solid #000000;} .vmenu{border:1px solid #aaa;position:absolute;background:#fff; display:none;font-size:0.75em;} .vmenu .first_li span{width:100px;display:block;padding:5px 10px;cursor:pointer} .vmenu .inner_li{display:none;margin-left:120px;position:absolute;border:1px solid #aaa; border-left:1px solid #ccc;margin-top:-28px;background:#fff;} .vmenu .sep_li{border-top: 1px ridge #aaa;margin:5px 0} .vmenu .fill_title{font-size:11px;font-weight:bold;/height:15px;/overflow:hidden;word-wrap:break-word;} $(document).ready(function(){ $(‘#rightclickarea’).bind(‘contextmenu’,function(e){ var $cmenu = $(this).next(); $(‘ ‘).css({left : ‘0px’, top : ‘0px’,position: ‘absolute’, width: ‘100%’, height: ‘100%’, zIndex: ‘100’ }).click(function() { $(this).remove(); $cmenu.hide(); }).bind(‘contextmenu’ , function(){return false;}).appendTo(document.body); $(this).next().css({ left: e.pageX, top: e.pageY, zIndex: ‘101’ }).show(); return false; }); $(‘.vmenu .first_li’).live(‘click’,function() { if( $(this).children().size() == 1 ) { alert($(this).children().text()); $(‘.vmenu’).hide(); $(‘.overlay’).hide(); } }); $(‘.vmenu .inner_li span’).live(‘click’,function() { alert($(this).text()); $(‘.vmenu’).hide(); $(‘.overlay’).hide(); }); $(“.first_li , .sec_li, .inner_li […]

Continue Reading

You may also like