Jump to content

Search the Community

Showing results for tags 'if else'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 3 results

  1. I have 3 variants of code that all do the same thing. Is there a best practice for choosing? Is it just appearance and ease of following or is there a technical reason to use one over the other? /*if ( ($(window).width() < 535) || ($(window).height() < 700) ) { if (scrollTop > stickyNavTop) { jQuery('body').addClass('stickynav'); } else { jQuery('body').removeClass('stickynav'); } } else { jQuery('body').removeClass('stickynav'); } if ( (scrollTop > stickyNavTop) && ( (($(window).height() < 700) || ($(window).width() < 535)) )) { jQuery('body').addClass('stickynav');} else { jQuery('body').removeClass('stickynav'); } if ( ((scrollTop > stickyNavTop) && ($(window).height() < 700)) || ((scrollTop > stickyNavTop) && ($(window).width() < 535)) ) { jQuery('body').addClass('stickynav');} else { jQuery('body').removeClass('stickynav'); } Cheers
  2. I'm trying to make this page working that has a vertical line of pictures (thumbnail-sized) which you can then click on to make them scroll to full width and show lots of text and happy stuff. I've already managed to do all that. However, if I click on one thumbnail, any open thumbnails are supposed to close. I've implemented an IF statement and class-checking for that: $("a#shins-rec1").clickToggle( function(){ if ($(".shins-rec").hasClass('done')) { $(".shins-rec").filter($(".done").not($(this))).animate({ left: $(".shins-rec").filter($(".done").not($(this))).width() / 2 - 60, width: '120px' }, 250, function(){ $(this).removeClass('done'); }); } else { $(this).parent().animate({ left: 0, width:'100%' }, 250, function(){ $(this).addClass('done') }); }; }, function(){ $(this).parent().animate({ left: $(this).parent().width() / 2 - 60, width: '120px' }, 250, function(){ $(this).removeClass('done') }); // even clicks }); which works all fine, but after you clicked two or three times on different thumbnails to open them and close the other ones, the already open thumbnail gets stuck and the clicked thumbnail opens as it should open. You have to click on the clicked thumbnail to close the other one, and then you have to wait some time till you can click the clicked thumbnail to properly close it again. After that it just stays like this. I've already tried doing it with a plugin called Summer of GOTO, because I think it has something to do with checking whether there are any "done" classes or not, so I wanted to make it re-check stuff using goto in JQuery. Using a WHILE statement didn't work either, but that could be because I don't understand that function.I tried adding .stop() before the .animate statement, but that didn't do anything special as well. Anyone knows how to solve this? Thanks in advance. Here is a JSfiddle of what I'm working on.
  3. how do i make this work? I need the if else statement to work.. like if i select ''samsung'' and i press submit the file must be included... but i just dont get the right code.. things that i've tried: if ($device="samsung")if (in_array("samsung" , $devices))if (in_array($devices="samsung"))and some others that i can't remember <html><body> <?php$devices = array('iphone' => 'iPhone', 'samsung' => 'Samsung', 'nokia' => 'Nokia', 'sonyericsson' => 'Sonyericsson', 'htc' => 'HTC',);echo '<form method="post">'; echo '<select>'; foreach($devices AS $key => $value) echo '<option value="'. $key .'">'. $value .'</option>'; echo '</select>'; echo '<input type="submit" value="Submit">';echo '</form>'; if (in_array($devices , 'samsung')){ include 'C:\xampp\htdocs\Websites\myfolder\includes\samsungmod.php';} ?></body></html> PLEASE HELP ME! thanks
  • Create New...