Jump to content

Search the Community

Showing results for tags 'Jquery PHP Show Hide'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 1 result

  1. I have a JQuery Script (vers 1.10.2) which shows or hides chunks of rows from a php based list. This works by showing or hiding a specific number of css related div elements by clicking the 'Show More' or 'Show Less' text at the bottom of the visible list. It works fine apart from when the Group Heading for a new group in the list appears and puts the incrementing div elements out of sync. Group Heading: echo "<div><h3 class='listrow'>Between ".$min." and ".$max." seconds.</h3></div>" Hmm - Just remove the div element in the group heading I hear you say. When I remove the div element from the sub heading part of the echo, all the sub headings appear at once but the rows work as they should do. i.e. show or hide upon a click. How can I fix this? Code below CSS: <style>.myDiv div{ display:none;}#MoreRows {color:green; cursor:pointer;}#MoreRows:hover {color:black;}#LessRows {color:red; cursor:pointer;}#LessRows:hover {color:black;}</style> JavaScript: $(document).ready(function () { $('.myDiv div:lt(41)').show(); $('#LessRows').hide(); var items = 50000; var minimum = 40; var shown = 40; $('#MoreRows').click(function () { $('#LessRows').show(); shown = $('.myDiv div:visible').size()+40; if(shown< items) {$('.myDiv div:lt('+shown+')').show();} else {$('.myDiv div:lt('+items+')').show(); $('#MoreRows').hide(); } }); $('#LessRows').click(function () { shown = $('.myDiv div:visible').size(); if(shown> 40) { calco = $('.myDiv div:visible').size()-40; $('.myDiv div').not(':lt('+calco+')').hide(); $('#MoreRows').show();} else {$('#LessRows').hide(); $('#MoreRows').show(); } });}); PHP <div class="content"><div class="listrow"><div class="myDiv"><?php$min = 0;$increment = 1;$max = $min - $increment;$rowclass = 0;while ($row_rs3 = mysql_fetch_assoc($rs3)){ if ($row_rs3['Seconds'] > $max) { while ($max < $row_rs3['Seconds']) $max += $increment; $min = $max - $increment; echo "<div><h3 class='listrow'>Between ".$min." and ".$max." seconds.</h3></div>"; } echo "<div class= row" . $rowclass . "><div class='alignleft'><a title=" . $row_rs3['Seconds'] . " specifications href=specifications.php?SpeedID=" . $row_rs3['ItemID'] . ">" .$row_rs3['Item'] . "</a></div><div class='alignright'> Speed - <b>" . $row_rs3['Seconds'] . "</b> seconds</div><div style='clear: both;'></div></div>"; $rowclass = 1 - $rowclass;}?></div><div id="MoreRows">More Rows</div><div id="LessRows">Less Rows</div> </div> </div>
×
×
  • Create New...