Latest news
Home » javaScript

javaScript

Jquery code for Animated Scroll to Top

Animated Scroll to Top

Create a div with class name gotop and Simply Copy paste the jquery code in betweenfor getting a scroll top functionality in a webpage. <div class=’gotop’>Scroll To Top</div> Jquery Code jQuery(window).scroll(function(){ if(jQuery(this).scrollTop()>1){jQuery('.gotop').css({bottom:"0px"})}else{jQuery('.gotop').css({bottom:"-100px"})}});$(window).ready(function(){$('.gotop').click(function(e){e.preventDefault();$('html,body').animate({scrollTop:0},700).animate({scrollTop:60},300).animate({scrollTop:0},400)})})(jQuery); Searches related to Scroll to Top scroll to top jquery, javascript scroll to top, scroll to top bottom of the photos, scroll to top photo, scroll to top ...

Read More »

How to Check Expired Sessions using jQuery Ajax and PHP

We can achieve using the php and ajax.The following ajax call execute in every 10 seconds to check the status of session.If it expired the user redirected to seesionout page. Ajax call in every 10 seconds   var check_current_session; function CheckForCurrentSession() { var strSession=”check_current_session=true”; jQuery.ajax({ type: “GET”, url: “check_current_session.php”, data: strSession, cache: false, success: function(result){ if(result== “Y”) { alert(‘Your session ...

Read More »

Get URL parameters using javascript or jquery

Example URL http://smarttips.in?newsletter=1 <script> var queryString = (function(url) { if (url == “”) return {}; var smart = {}; for (var i = 0; i < url.length; ++i) { var pS=url[i].split(‘=’, 2); if (pS.length == 1) smart[pS[0]] = “”; else smart[pS[0]] = decodeURIComponent(pS[1].replace(/+/g, “””)); } return pS; })(window.location.search.substr(1).split(‘&’)); $(document).ready(function(){ if(queryString[“newsletter”]==1) { alert(‘Got it!!!’) } }); </script>

Read More »

Restrict ckeditor to basic toolbar

We can use javascript or jquery to apply ckeditor configuration HTML <textarea id=”textarea” cols=”15″ name=”txtdesc” rows=”5″></textarea> Javascript Must be included ckeditor.js Take the instance of ckeditor and replace with new configuration <script type=”text/javascript”> var editor = CKEDITOR.instances[‘txtdesc‘]; if (editor) { editor.destroy(true); } var editorContent =CKEDITOR.replace(‘txtdesc‘, { toolbar: [ { name: ‘document’, items: [ ‘Source’, ‘-‘, ‘NewPage’, ‘Preview’, ‘-‘, ‘Templates’ ] ...

Read More »

copy to clipboard using jQuery

<a href=”javascript:void(0);” id=”userlinkId” style=”display: inline;”>http://localhost/profile/sijo</a> <script type=”text/javascript”> jQuery(document).ready(function(){   jQuery(“a#userlinkId”).zclip({       path:’js/ZeroClipboard.swf’,       copy:jQuery(‘#userlinkId’).text(),       beforeCopy:function(){           jQuery(‘#userlinkId’).hide();           jQuery(‘#copymessage’).css(‘color’,’red’);           jQuery(‘#copymessage’).html(‘Copied to clipboard’);           jQuery(‘#copymessage’).delay(2000).fadeOut(400);       },       afterCopy:function(){         ...

Read More »

Signup or login through facebook

<div><a href=’javascript:void(null);’ onclick=”login();”>Signup/ login through facebook</a></div> <div id=”fb-root”></div> <script src=”http://connect.facebook.net/en_US/all.js”></script> 1. Include the above facebook all.js first. <script> 2. Initialize the facebook app settings. jQuery(function() { FB.init({ appId  : ” <12356666>”, status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml  : true  // parse XFBML }); });. //function ...

Read More »