Showing posts with label Jquery. Show all posts
Showing posts with label Jquery. Show all posts

Thursday, December 4, 2014

Implement Jquery infinite scroll plugin

Plugin Source: https://github.com/paulirish/infinite-scroll/

Automatic Scroll:
$('selector').infinitescroll(options);

 Manual Scroll:
$('#scroll-container').infinitescroll(options);
$('#scroll-container').infinitescroll('unbind');

$('.view_more').click(function() {
    $('#scroll-container').infinitescroll('retrieve');
    return false;
});

Note:
You may have to add the manual trigger behavior if you are working with masonry or isotope in order to make it work. Just include manual-trigger.js after infinitescroll and pass the behavior by passing behavior: 'twitter' when calling the plugin.

Tuesday, March 27, 2012

Restrict cut, copy and paste in text area using Jquery

HTML:
<textarea id="textarea_id" > </textarea>
Script:

$(document).ready(function() {
$('#textarea_id').bind('cut copy paste', function(e) { e.preventDefault(); });
});