Category: javaScript

Animated Scroll to Top

Jquery code for 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

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){

Get URL parameters using javascript or jquery

Example URL <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; })(‘&’)); $(document).ready(function(){ if(queryString[“newsletter”]==1) { alert(‘Got it!!!’) } }); </script>

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’, ‘-‘,

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);       },      

How to get current time with jQuery?

<script type=”text/javascript”> var TodayDate=new Date(); var currentHours = TodayDate.getHours(); var  currentMinutes = TodayDate.getMinutes(); var  currentSeconds = TodayDate.getSeconds(); </script>