Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: How to fire click event of an LI tag?

  1. #1
    Join Date
    Apr 2012
    Posts
    85
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default How to fire click event of an LI tag?

    Hello Dear,

    xhtmljunkies.com this is my site & please open:

    xhtmljunkies.com/logo-designing.html

    page. Click on View Our Portfolio button.
    Now you will see portfolio page right?

    So now my question is if you directly open portfolio page then there is no problem because user will click the buttons and get the respective result but if I come through another page then I am able to it's respected results but when I click on other tabs then their respective results are coming but very weired. I did the thing like below.

    I put the script at the end of portfolio page so when it finishes loading then it is executed....Currently I put this in local


    Code:
    if(page=portfolio) // this is I am getting through php so not to worry for this line
    {
    INSTEAD OF li I PUT .cat-item-8 TO TEST LOGO DESIGN DIRECTLY FOR EXAMPLE..........GOT THAT?
    
    		var s = jQuery.noConflict();
        
        // Clone applications to get a second collection
        var $data123 = s(".portfolio-area").clone();
            
        s(".filter li").removeClass("active");	
        // Use the last category class as the category to filter by. This means that multiple categories are not supported (yet)
        //var filterClass=$(this).attr('class').split(' ').slice(-1)[0];
        
        var filterClass123 = "cat-item-8";
        
        if (filterClass123 == 'all') {
                var $filteredData123 = $data123.find('.portfolio-item2');
        } else {
                var $filteredData123 = $data123.find('.portfolio-item2[data-type=' + filterClass123 + ']');
        }
        
        //alert($filteredData);
        
        s(".portfolio-area").quicksand($filteredData123, {
                duration: 600,
                adjustHeight: 'auto'
        }, function () {
    
    				lightboxPhoto();
    						});		
        s(this).addClass("active");	
    }
    It's respective things are coming but now when we click on another tab then those's respective things are coming but looking very weired. The above code I am trying in local but if problem would be solved then I can live. If someone comes to this question & if ask to do these changes in live then I can do it in live for quick watching result so you can get the idea quickly

    Can you help?

    Thanks
    Kaushal
    Last edited by round; 01-11-2013 at 10:55 AM. Reason: changes

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    In jQuery like you're using on that page:

    Code:
    jQuery(DOM_or_CSS_reference_to_the_LI_tag).trigger('click');
    There are other ways. See also:

    http://api.jquery.com/?s=trigger

    However, I think you might have other problems. I was playing around with the portfolio page, clicking XTML and then ALL PROJECTS and then back again and again and again and the browser crashed.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2012
    Posts
    85
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Dear jscheuer1,

    Should I live the thing now to see that directly in live?
    So that will be easy for you to gudge the problem.

    I am quite close to the solution.

    Thanks
    Kaushal

  4. #4
    Join Date
    Apr 2012
    Posts
    85
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Hello jscheuer1,

    I have made things the live. please see:

    xhtmljunkies.com/logo-designing.html

    & click on View Portfolio Button then you will be redirected to

    xhtmljunkies.com/portfolio.html

    You will see the Logo Design's things but logo design is not selected & Now if you click on other tabs you will see that the respective results are coming but weired.

    The thing is if you directly open portfolio page then all the things will be fine but if you go from xhtmljunkies.com/logo-designing.html then other tabs are not working.

    Can you please help?

    Thanks
    Kaushal
    Last edited by round; 01-12-2013 at 08:01 AM. Reason: to be more specific

  5. #5
    Join Date
    Apr 2012
    Posts
    85
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Hello Dear,

    Because the site is live I am removing the above stated changes. Now I will again do changes on Wednesday. I make the changes in live to let you understand the problem very quickly

    So will meet on Wednesday.

    Thanks
    Kaushal

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Please don't hotlink to your pages. I've fixed the ones in the above posts. In the future, instead of typing like:

    http://www.xhtmljunkies.com/portfolio.html

    Instead type it like so:

    xhtmljunkies.com/portfolio.html

    We can still paste it into our browser's address bar and get there, but it won't cause a problem with search engines.

    Also, if I happen to be around on Wednesday I can check out the problem. It would be better if you could make up live copies of the pages that are, as I say live, but not a part of the main site. That way I, or anyone, could look at the problem at any time.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Apr 2012
    Posts
    85
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Dear jscheuer1,

    I have made the things live.

    xhtmljunkies.com/logo-designing.html

    & click on View Portfolio Button then you will be redirected to

    xhtmljunkies.com/portfolio.html

    You will see the Logo Design's things but logo design is not selected & Now if you click on other tabs you will see that the respective results are coming but weired.

    The thing is if you directly open portfolio page then all the things will be fine but if you go from xhtmljunkies.com/logo-designing.html then other tabs are not working.

    Can you please help?

    Thanks
    Kaushal

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Code:
    jQuery('li.cat-item-8').trigger('click');
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Apr 2012
    Posts
    85
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Dear Jscheuer1,

    Thank you for your kind reply. But if I put that statement then only Logo Design tab remains selected but not the relevant result.
    Though Logo Design Tab is selected, please click on it. Now you will see it's relevant result.

    Now can you suggest what's the problem?

    Thanks
    Kaushal

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Well, if I just run it:

    Code:
    jQuery('li.cat-item-8').trigger('click');
    in the console, it highlights the Logo Design tab and carries out the action.

    I would suggest getting rid of everything you have in your first post in this thread. Then, get the POST data value of 'page' via PHP. If it's 'logo-designing' run that snippet on page load. Something like:

    PHP Code:
    <?php
    if($_POST['page'] == 'logo-designing'){ ?>
    <script type="text/javascript">
    jQuery(window).load(function(){
        jQuery('li.cat-item-8').trigger('click');
    });
    </script>
    <?php ?>
    To work right, you may have to put it at the end of the page.
    Last edited by jscheuer1; 01-16-2013 at 06:52 AM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. [HELP] Click event inside javascript
    By 4rum25 in forum JavaScript
    Replies: 0
    Last Post: 09-14-2010, 07:51 AM
  2. Replies: 1
    Last Post: 04-03-2010, 11:21 PM
  3. MooTools: Problem with click event.
    By JBottero in forum JavaScript
    Replies: 2
    Last Post: 08-31-2009, 12:28 PM
  4. how to force fire the onChange event
    By rizlaa in forum JavaScript
    Replies: 5
    Last Post: 03-15-2009, 10:54 PM
  5. click event for <select> <option>
    By HockeyFan in forum HTML
    Replies: 4
    Last Post: 09-17-2005, 04:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •