Hi.
I'm working on a usability issue on a website. I have a jquery accordion slider, each slide has a link to a category. Now what happens is that when I go to the category page by clicking on a slider, when the page loads, the sliders always opens the first slide. For example, if I click on the third slide, I would like that slide to be open when the page loads.
This is similar to the :current I believe. I think to solve what I need I must trigger a click on the third slide that third slide page opens.
I know I need a reference for a condition, so I have ID'd my body through this php code were it gets the page name from the url into variable $page and then into do body's ID:
Now I've been trying through Javascript to get the variable from php and trigger a click on the slide of the category it is opening:PHP Code:<?php
$page = $_SERVER['REQUEST_URI'];
$page = str_replace("/","",$page);
$page = str_replace(".php","",$page);
$page = str_replace("?s=","",$page);
$page = $page ? $page : 'default'
?>
<body id="<?php echo $page ?>">
This is not working and I don't really know what's wrong and how to solve or search for help.HTML Code:<script type="text/javascript"> var bodyid = "<? $page ?>"; if (bodyid == "energy") { $("document").ready(function() { setTimeout(function() { $("ul#accordion li:second-child).trigger('click'); },10); }); } </script>
Does anyone understand what I'm trying to do here? Thank you.



Reply With Quote


Bookmarks