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. 1st option:PHP script uses data from phpbb's sql, sends to ajax, ajax via javascript goes to HTML and works fine, and shows č, ć, ž, š, đ.2nd option:PHP script uses data from phpbb's sql, and later, that script is included to other page, but won't show chars. Just ? ...
  14. Hi,I need to extract data from phpbb's mysql database to my web script.Some chars (č, ć, ž, š, đ) works fine with phpbb which uses <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> On my script some of those are written fine, but others like ? (question mark)I've tried utf-8 at page, and windows-1250.What to do now?
  15. [dx]

    Browser Discussion

    IE sucks. Over a month or two I'm trying make menu with ul tag. And CSS really makes me crazy. It's super with FF, Safari, Chrome, Opera, but IE. HATE IE DEVELOPERS!Is it hard to use standards...?
×
×
  • Create New...