Posts

Showing posts with the label CSS

Inserting 'back to top' link dynamically using jQuery

Image
Introduction Download I have seen many articles/blogs etc. on web that has huge information on a single page; some of them already using this technique that I am going to talk. Okay, for now look at the animated image given below. Note: Image size is 1.4 MB, please wait to respond. You can see, whenever I click on 'back to top' URL, page scrolls to top. At very first, you will think that I have inserted something like <a id="top1"></a> at the top and at the end of each <p> I have inserted URLs which is like <a href="#top1">back to top</a>  to navigate to top. But you're wrong, this is not my technique. I have inserted these all dynamically, without looking the number of places to insert URL or how huge content do you have at the web page. You can use this feature anytime; all your earlier web page will start functioning. So, what's the magic behind. Let's look at the jQuery codes

Handle Controls Attribute using jQuery

Image
Introduction This post shows how to handle or target controls attribute using jQuery. We already talked how to modify the appearance of controls on web page when user, hover the mouse or click the mouse. For this we used .addClass(),.removeClass(),.css(), .toggleClass() etc. I'm going to cover some cool stuffs using problem to solution approach. So, let's start and look at first problem. Problem 1 If you simply want to open all URLs on new tab, a quick jQuery code can do this using .attr() method. Note: For more read this . .attr() Method .attr() gets the value of an attribute for the first element in the set of matched elements. Problem 2 If you have a website that uses huge list of images there and forgot to place alt (alternative) text (when image not found, that will be displayed), how to fix this. I mean how you will add a brand new attribute to existing list of controls? Don't worry, here it the fix. Look at result in b

Handling URLs (Hyperlinks) using jQuery

Introduction Assume I have a blog/website and I want all external URLs to open on new browser tab. For example when you click on any external URL on Facebook, it opens URL on new tag. No meaning you have mentioned "target" attribute with URL or not, I always want external URLs to open on new tab. In addition with this, I also want to add an external icon with all external URLs. How to do this? Let's read all one by one. If you simply want to open all URLs on new tab, a quick jQuery code can do this. Here you go. jQuery Code     < script src ="Scripts/jquery-1.4.1.js" type ="text/javascript"></ script >     < script type ="text/javascript">         $(document).ready( function () {             $( 'div.MyURLs a' ).attr({ target: '_blank' });         });     </ script > Using above jQuery, just adding a new attribute 'target' to '_blank' to all URL

Applying Slide in DIV using jQuery

Image
Introduction Download In this quick post, you will learn how to apply slide in DIV tag using jQuery. We will first look at the animated image (working example) and then will see the code. Now look at the codes. jQuery Code     < script src ="Scripts/jquery-1.4.1.js" type ="text/javascript"></ script >     < script type ="text/javascript">         $(document).ready( function () {             var $VarAbout = $( '#About' );             $( '#Title' ).click( function () {                 $VarAbout.slideToggle( 'slow' );             });         });     </ script > We already talked on the concepts used above in earlier posts, read previous posts if you are not getting. ASPX Code (Body) < body >     < div style =" width : 300px ; text-align : justify ; padding : 1px ; border : 1px solid #CCCCCC ; font-family : Verdana ; font-size : 1

jQuery .animate() Method - Part 1

Image
Introduction Download In short, jQuery .animate Method used to perform a custom animation of a set of CSS properties. .animate() Method comes in two  flavor . First takes four arguments and second takes two arguments. First Flavor .animate( properties [, duration] [, easing] [, complete] ) Properties and values : A map of CSS properties that the animation will move toward. Duration or Speed : A string or number determining how long the animation will run. Easing : A string indicating which easing function to use for the transition. Complete : A function to call once the animation is complete. Second Flavor .animate( properties, options ) Properties and values : A map of CSS properties that the animation will move toward. Options : A map of additional options to pass to the method. The .animate() method allows us to create animation effects on any numeric CSS property. The only required parameter is a map of CSS properties.

Fancy and Animated Hide and Show of Paragraph Tag using jQuery

Image
Preface Download This post shows how to create a Fancy and Animated Hide and Show of Paragraph Tag in ASP.NET using jQuery. Please assume this post as addition to my last post titled "Animated Hide and Show of Paragraph Tag using jQuery". If you review my last post, you will notice that I have used two different <a> tags that is <a href="#" class="show"> and <a href="#" class="hide">, and by using jQuery .hide() and .show() methods I switched both one by one. But it is not the right way, if jQuery has compound effects. If we use Compound Effects, only a single <a> tag will do all this, even rest coding will become short and quick. Setup Demonstration Page Let's setup the demonstration page, find the code below: Steup jQuery Methods Let's setup the jQuery methods, find the code below: This toggling can be achieved by first checking the visibility of the matched el

Animated Hide and Show of Paragraph Tag using jQuery

Image
Preface Download In the last post, I already described how to use .hide and .show jQuery methods. In this post I am just going to add jQuery animations to existing code. So, please go through my last post to understand this post better. Here is the one (source: from my last post) screen having NO ANIMATION: Introduction Animated actions speak louder than simple text. jQuery let us add impact to our actions through a set of simple visual effects, even craft out own more sophisticated animations. To setup the demonstration page, please read this post "Simple Hide and Show of Paragraph tag using jQuery". I wish you setup your demonstration page, if so, here you go. Speeding Animations As in last post, when you click on <a href="#" class="show">Show More</a>, calls the following method $('a.show').click(function () {    $('p').eq(1).show();    $('a.show').hide();    $(&#

Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System

Lambda two tables and three tables inner join code samples