Search Results

Search found 2 results on 1 pages for 'socheata'.

Page 1/1 | 1 

  • Endless scroll paging in jquery Safari

    - by socheata
    I'm using : $(window).scroll(function () { if ($(window).scrollTop() + 10 >= ($(document).height() - $(window).height())) { loadContent(); } } It works fine with Chrome, IE, Firefox but except in Safari. In function loadContent, I used JSON to load data, as this tutorial. But while I test in Safari, It takes the content twice from JSON. If the other takes 9 items, then Safari takes 18 items. Does anyone know how to solve this problem? Thanks.

    Read the article

  • Convert from c# function to javascript function

    - by socheata
    I have a function in c# that used to manipulate the string, It works well while I used in C#. Now I want to convert this function to use in javascript. This is the function in c#: public static string TrimString(string str, int lenght) { string _str = str; int _iAdditionalLenght = 0; for (int i = lenght; i < str.Length; i++) { if (_str.Substring(i, 1) == " ") break; _iAdditionalLenght++; } return str.Substring(0, str.Length < (lenght + _iAdditionalLenght) ? str.Length : (lenght + _iAdditionalLenght)); } I converted it to javascript : function TrimString(str, lengthStr) { //this is my testing 4 var _str = str; var _iAdditionalLenght = 0; for (var i = lengthStr; i < str.length; i++) { if (_str.substring(i, 1) == " ") break; _iAdditionalLenght++; } return str.substring(0, str.length < (lengthStr + _iAdditionalLenght) ? str.length : (lengthStr + _iAdditionalLenght)); } But the javascript doesn't work. Could anyone tell me, how could I do it in javascript function? Thanks you so much.

    Read the article

1