Jump to content

[dx]

Members
  • Posts

    719
  • Joined

  • Last visited

Everything posted by [dx]

  1. Hi,I'm stuck here a lil bit. I have this. file1.php $var = 'something'; file2.php class init { function load_script() { require_once('file1.php'); }} file3.php include('file2.php');init::load_script(); So my problem is that $var is null in file3.php After loading file1.php from file2.php variable is visible, but I need it in file3.php Regards
  2. Hi, As topic title says, can we detect change of src of image with jquery. Not that image is not loaded with page load. It's appended later.
  3. Found a way of unseting pic_name after set on pageload, and add checking if (pic_name) then set.
  4. To not open other topic, I'll post here.. I have: $('.thumb_img').click(function() { ... var pic_name = $(this).attr('src').replace('thumb_', ''); $('#pic_src').load(function(){ console.log('src set on pageload: '+pic_name); $(this).attr('src', pic_name); }); ...}); Then I have: $('.thumb_prev').live('click', function() { var src = $(this).attr('src'); $('#pic_src').animate({opacity: 0}, 300, 'linear', function() { $(this).attr('src', 'loader.gif'); console.log('new src: '+src); $(this).attr('src', src.replace('thumb_', '')).load(function() { $(this).stop(true, true).animate({opacity: 1}, 600); }); });}); So, I have list of images with class thumb_img and when you click on it, you get preview (bigger) of image.So next to big image are thumbnail with class thumb_prev. Then when I click on thumb_prev it catchs it's src and change central image with id pic_src. My output in console is like.. src set on pageload: 1.jpgsrc set on pageload: 1.jpg After click getting this: new src: 2.jpg <-- this is OKsrc set on pageload: 1.jpg <-- same url as pageloadsrc set on pageload: 1.jpg <-- same url as pageload Why it call .load() from .thumb_img if I click .thumb_prev?
  5. Solved, it was .live instead of .bind Copied from some support site:
  6. Well, it's solved, and after I append this image, also I append some thumbnails next to image.And I have $('.thumb').click(function() { }); but script don't respond to any click. Image is added with class thumb. I'm guessing it is becouse it's appended and not loaded by page. How to activate click? I've tried with .trigger() and .bind() as it's in example on jQuery tutorial site.
  7. Argh.. .pic_preview is 100% width and 100% height div with white background, which covers all data on site with z-index: 1000, and img has z-index 1001.
  8. But what if I do fadeTo, will image fade also as a child of .pic_preview?That's reason becouse I've avoided to append it to .pic_preview.
  9. Hi, I'm trying to make effect of showing image with jQuery.Now I'm using this script. $('.thumb_img').click(function() { var n = $(this).attr('src').replace('thumb_', ''); $('body').append('<div class="pic_preview"></div>'); $('.pic_preview').fadeTo('slow', 0.9); $('body').append('<img id="pic_src" src="'+n+'">'); $('#pic_src').fadeIn('slow').css('visibility', 'visible');});$('body').keyup(function(e) { if (e.which == 27) { // ESC key $('#pic_src').fadeOut('fast', function() { $(this).fadeOut('fast', function() { $(this).remove(); }); $('.pic_preview').fadeTo('fast', 1.0).fadeOut('slow', function() { $(this).remove(); }); }); }}); So it works fine, shows image etc., except when first time click on thumb, big image in #pic_src is shown slowly with fadeIn, and when I ESC it, and then click again on same thumb, image is just shown without fade. In CSS, I'm using visibility: hidden for #pic_src Regards.
  10. Thanks, it helped. I solved it by getting data (heights) first, then .hide() all elements which needs to be hidden.
  11. I've just tried add display: block to index 1 and it shows correct height. But all my divs are loaded in background to source code but with display none. How can I get height for every div?
  12. Hi, I'm breaking my head few days. I've read whole jQuery page but no help. I have many divs with same class. If I do console.log('.myClass').length); in my case I get 14 elements, and if I try $('.otherClass').each(function(index) { $('.myClass:eq('+index+')').height();}); I get height only for index 0, every other index returns value 0. otherClass is also 14, same as myClass. Also, all my divs have display none propery, except first div with index 0 is display block. It's something like tab sistem. So can it be problem? Regards
  13. Hi, I have problem storing data to array. I have few textareas and I'm trying to fetch data from and store to array and send via ajax after.I'm getting proper data when alerting, one by one, but with loop when trying to store, data are not stored. If I alert joined string, it it like ,something So there's only last data, with comma in front of. I'm using array.push(data);
  14. Hi, Just a hint to anyone who get stuck with this problem. Check does your page tries to load some element which is empty. In my case that was <link rel="shortcut icon" href="/favicon.ico"> but favicon.ico wasn't located at server. After I've added it, it started working normal.
  15. No, at this part. ".strtolower(date('M'))."=".strtolower(date('M'))."+1"
  16. Hi, I'm using this SQL statement but it updates twice. I'm sure that this line is writtent just on one place in whole page. mysql_query("INSERT INTO clicks (year, ".strtolower(date('M')).") VALUES ('".date('Y')."', '1') ON DUPLICATE KEY UPDATE ".strtolower(date('M'))."=".strtolower(date('M'))."+1"); So it works fine just instead of it is doing increment by 2. I've tried standard mod with select, checking update if num rows > 0, or else insert. Like it calls statement twice. Can it be some error with mysql?
  17. [dx]

    Upload file script

    Heh, I found error.. It was like: if ($_FILES) {}echo { echo 'something';} Thanks..
  18. [dx]

    Upload file script

    Hi, I have to parts of uploading pictures from my admin cp. So one works fine, but with other is problem.Getting error 500 (Internal Server Error) in Chrome console. Both of scripts are same. Form, target to iframe, checked names, ids, everything. And, yes, I'm using htaccess file.There's nothing in htaccess file which declares some file, and other not. Two upload script uses two differrent files.. Regards
  19. Hi, I need little help. I have table category, also I have table objects. Objects have id_category in attributes. Also there's attribute called picture in objects. So I need list all categories, and I need list 3 objects from by every category with their's pictures. So what I need is: category 1: - object 1 - object 2 - object 3category 2: - object 1 from cat 2 - object 2 from cat 2 - object 3 from cat 2 and so on. I could do that by loop and call object's picture every time when list category.For ex. if I have 15 categories, it would do 15 queries for every cat.. If it's only solution, I'll work on it. Regards.
  20. There are server side files which works only with AJAX, and which are not loaded by index. So session in those files won't work, in loaded by index works fine.
  21. First session_start() is at top of index.php file.And every page loads trough index like index.php?page?some_page And it starts while using page for view, but other server side files messes up, so I need add @session_start() And session is started, with index.php load, but nothing is written to session file, but nevermind, it works.
  22. I solved this by adding @session_start(); at top of files which works with $_SESSION. Maybe it's wild method but works.
  23. No, I don't change anywhere.. Today I've tried to store data from index.php file (not calling from function), and it worked.Like it not allow storing from function.. I guess I'll must find other way to solved this. I have one idea on my mind but this is easier way for me.. After some research, I notified that it won't store when it is called in remote file, but when in index.php (some file which is directly loaded to browser) it is ok.
  24. Maybe it doesn't have permission to write to the file. It does have. I've set chmod 777 for session folder, also I've tried setting chmod 777 for session file after it is created. Maybe you're not storing the data correctly. It does not store anything in session file. (file is empty) Did you set the options to report and log all errors from PHP, including startup errors? I'm using error_reporting(E_ALL); Did you change the default location to store session files in? If you did, does it work with the default? Yes, I did. Not working for any location, default, or changed. What do you mean some other session? I mean some other session name, like $_SESSION['session1'] and $_SESSION['session2'].If I try something like $_SESSION['test'] = 'something';, there's data in session file like: test|s:9:"something"; I haven't seen a value for $cookie so I don't know if that affects anything. I've tried print $cookie value and it is correct. (just using letters and _) I saw the login function, is that the same function you use on all areas, both the places that work and the ones that don't? Yes, it is. Is the value of $cookie always the same, both in the places that work and the ones that don't? Yes, there's one conf file with $cookie = 'cookie_name';
×
×
  • Create New...