Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(e) {
- var testo = $('.word').val();
- var k = 0;
- var n = 0;
- $('input').serialize();
- coll=[];
- $('.search').click(function(e){
- e.preventDefault();
- testo = $('.word').val();
- if(testo != "")
- {
- testo = $('.word').val();
- $("p:contains(" +testo+ "),h1:contains(" +testo+ "),h2:contains(" +testo+ "),h3:contains(" +testo+ "),h4:contains(" +testo+ "),h5:contains(" +testo+ "),h6:contains(" +testo+ "),h7:contains(" +testo+ ")").addClass("found");
- $(function() {
- coll=[]
- n = 0;
- $('*.found').each(function(){
- n++;
- id = $(this).attr({'id': "id"+n})
- coll.push(n)
- })
- //console.log(coll)
- })
- //console.log(testo);
- }
- else
- return false;
- });
- $('.clear').click(function(e){
- e.preventDefault();
- n = 0;
- k = 0;
- $('.word').val("");
- $("p:contains(" +testo+ ")").removeClass("found");
- //console.log(testo);
- });
- $('.next').each(function(index, element) {
- k = 0;
- $(this).click(function(e){
- e.preventDefault();
- var testo = $('.word').val();
- if(testo != "" && k <= coll.length-1)
- {
- k+=1;
- //console.log(k);
- $('body').scrollTo("#id"+k,{duration:'slow', offsetTop: '30'});
- }
- else
- return false;
- });
- });
- $('.prev').each(function(index, element) {
- k = 0;
- $(this).click(function(e){
- e.preventDefault();
- var testo = $('.word').val();
- if(testo != "" && k > 0)
- {
- k-=1;
- //console.log(k);
- $('body').scrollTo("#id"+k,{duration:'slow', offsetTop: '30'});
- }
- else
- return false;
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement