Tag: jQuery

C

Combining Multiple attributes in jQuery

Below are some of the code snippets available in jQuery for you to combine your multiple lines of code: Combining multiple css properties or element attributes: Statement: Set the width and height attributes for a table with id=mytable $("#mytable").attr({width:'50px',height:'40px'}); Statement: Set the css properties of width, height, background-color for a div with id=mydiv $("#mydiv").css({width:'50px',height:'40px',background-color:'#F2F2F2'}); Combining ...

B

Best Practices for jQuery Developers

Following are some of the best practices that you could follow while working with jQuery: Plugins: Please avoid unnecessary use of plugins If a plugin is being used, respect the authors work and ensure that the plugin file is reused with the license comments intact If you are writing a reusable functionality in the code, ...

G

Generate JSON string output in C#

This is one of the most widely used and very useful script that you could use in your web services/ WCF services/ Handlers or any place wherein you require a JSON string to be passed to the client/ consumer. We make use of the Serialize method in JavaScriptSerializer class in C# under the following namespace: ...

S

Selecting a complex jQuery selector present in a page

Most of time, the moment we see a complex ID like 'ctl00_m_g_f368f5ab_d679_4436_a6da_938c6bfcd60a_ctl00_SearchCheckBox' we faint... 😉 And what we end up is start finding some parent which has an ID or see if there is a css class defined for this control. Targeting a control using its parent is good and performance-wise effective. However, using a ...

S

Solve Flickering jQuery accordion issue in MOSS 2007

MOSS 2007 for the simple reason of missing a DOCTYPE can screw up the smoothness of animations created through jQuery. One of my situations didn't allow me to add DOCTYPE to my master and my clients ended up seeing flickering animation of the accordion. Seriously that was irritating. Being an ardent admirer and an evangelist ...

E

Enable Tab navigation for your entire page using jQuery

One of the most commonly faced Accessibility issue is in maintaining the tab order. If you don't take it the right way, you might end up wasting days and days of effort, when you can just get it done in 2mins using jQuery. Requirement: Clicking on tab should go through all the functional controls on ...

j

jQuery Plugin: Page Size Analyzer for Page Performance Monitoring

One of my senior Technical Architect asked me if i could come up with some useful widget that could help him display the page size of the current page. I thought of writing a jQuery plugin that could do this job. I am sharing it here. Do read the notes carefully before using it. Screenshot: ...

3

3D Carousel jQuery

One of the widely used and personally, i too recommend this one. the Cloud Carousel. Thought of attaching a sample here. Try it out. Its pretty simple and effective. The main site: Professor Cloud You can download the source code here: 3d Carousel [Please rename the .pdf to .zip... WordPress complications.. :P]

W

When Microsoft or Google CDN fails, what should u do?

// Let me tell you one thing, an outage in CDN is very rare. But just in case you don't want to take a risk, go ahead with this fallback mechanism, as suggested by Scott Guru. Microsoft CDN outage for jQuery: <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script> <script type="text/javascript"> if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='/Scripts/jquery-1.4.2.min.js' type='text/javascript'%3E%3C/script%3E")); ...

j

jQuery noConflict Tips

Some tips which i feel you need to know before using jQuery library: 1. You can use jQuery instead of $. 2. Predefined alias for jQuery: you can assign jQuery to any variable. With this you can load any versions of jQuery into your site. <!-- load jQuery 1.1.3 --> <script type="text/javascript" src="http://code.jquery.com/jquery-1.1.3.js"></script> <script type="text/javascript" ...