jQuery Accordion plugin - SHOPIFY - javascript

I'm hoping someone can help to answer my question...
I am currently using an accordion on my Shopify site to display some pretty extensive content. You can see a demo of what I'm using here: http://www.snyderplace.com/demos/accordion.html
I'm wanting to be able to create a link on my webpage that will take the customer to, say the 3rd panel of the accordion OPEN, but I just can't figure out what JS I need to be using to do this! Can someone help! Please?

First thing that comes to my mind is passing a a meaningless # along with the link, like you would be going to a anchor. Then on page load check to see if the URL contains the hashtag, if true trigger the panel you want to open.
Link on initial page:
<a href="/newpag#panel-3" >link</a>
jQuery:
if(window.location.href.indexOf('#panel-3')){
$('.thirdSection').trigger('click')}
I haven't tested this at all but with a bit of tweaking it should do the trick.

Related

url.split with link created by cms applied to navitagation tab

I am very new to javascript... I would like to know if someone can help me, I have made a navigation tab that I want to be active when I visit a certain url... well, with split I have been able to do it in most of the links that needed...
But the CMS I'm using generates part of that link... and I can't complete the script...
the example of the full link is:
https://www.example.com/shop/index.php?rp=/announcements/1/New-Website-redesigned.html
Well that already with the final result... the problem is that there are quite a few possible results from
https://www.example.com/shop/index.php?rp=/announcements
There are several options to choose from and among those, when you click, it sends to the link above, (eye is content created by the cms) the idea is that the tab always stays active when browsing everything that is announcements and its derivatives. ..
for this i used the following in most of my links.
if(url.split('?')[0] === 'https://www.example.com/shop/supporttickets.php'){
btn1.classList.remove('active')
btn2.classList.remove('active')
btn3.classList.add('active')
btn4.classList.remove('active')
btn5.classList.remove('active')
}
This generally works, but I can't apply it to the example above...

How to hide text if it is not homepage?

For example if i make a widget on wordpress, how can show it only in homepage? Can i make a Javascript code that can show Div element only in homepage and if it isnot homepage to hide it? How can be such a code?
you can use is_home() method in your template or you can define the sidebar only for the page where you need it.
You can catch the base url of homepage and see if it is the url display it else not.
If you are using wordpress, there are settings you can use to lock widgets down to certain pages. It really depends on the plugin you are using though.
If you have short codes, you can simply put the short code for that widget on just the pages you want to see it and not the ones you don't.
If not, there is usually a setting under the widget that should allow you to set the page it is displayed on or the pages you want to exclude it from. This would be in the Widgets tab in the wp-admin panel on the left side.
I would give you more specifics and even examples, but im not sure what plugins you are using. Give me a little more example of what you are working with and I will help you however I can. Good luck.

Hiding Link In SharePoint Quicklaunch Based On Permissions

I am trying to figure out a way to hide a specific link from the Quicklaunch navigation bar on one of my sites in SharePoint 2013 and am having some trouble. Basically I am trying to make it so that a link is only visible to users within a specific group and any other users that are not part of this group will not see the Quicklaunch link. I have been reading up on how to implement this via css and javascript within the default master page but do not seem to be having any luck. I was using SPServices to get the group membership for the currently logged in user and based on there membership either hiding or showing the specific Quicklaunch item. I implemented this code into the master page and I though I had it working, however upon navigating to a different page, list, or library within the site the given link reappears. I do not know if I am doing something wrong but as a last resort I have come here for answers. If anyone could point me in the right direction I would greatly appreciate it.
Bellow is a screenshot to get a better understanding of what it is I am trying to do...
Security trimming should be automatic for the quick launch. Users not being able to see the list, should not see the quicklaunch entry. One thing i experienced in the past is that the security trimming does not work if your quick launch URL looks like this
https://url/sites/sc/Lists/internallistname
but will work if you include the aspx-page
https://url/sites/sc/Lists/internallistname/AllItems.aspx
Don't know about foundation but it's worth a try...

Reload only main page content on link click

So i'm trying to do an effect similar to this http://www.hffm.co.uk/
When you click on another page the entire page Does NOT reload just the main content in the center But the link at in the navigation does
I.e http://www.hffm.co.uk/contact after contact page is clicked
What i want to know is how is this done? I don't like using jquery but can convert it if you can only explain it that way. I figure it's AJAX related but can't be sure. Does this kind of loading have a name?
I need to know what to search so i can find it google to figure it out myself but i have no idea where to go looking.
yes it's possible with ajax.
it's call asynchronous load. Im not realy skilled to explain so here is a link
http://www.w3schools.com/php/php_ajax_poll.asp
I hope it helped

Change the URL in partial post back

I am developing a shopping site where user can search products using different criteria.
On checked_changed event of check box i want to change URL, but condition is that my page does not make full post back..
This answer will help you......
You need HTML5-able browser and some JavaScript. Here is the demo of HTML5 history feature.
GitHub implemented that feature for tree browsing. And there is screencast in railscast.com.
Original answer is :
change url without making page postback -- mvc
Perhaps this is the solution http://www.asual.com/jquery/address/ - asual provides the functionality for easily changing addresses on the fly
What I can see there is the same functionality where we link an anchor tag to a div in the same page by appending #. You can see the the URL is changing by just appending the #!gender=men/page=1 to the end.
Also there is no checkbox. I saw that portion in firebug. Its just an image. But we can achieve it through checkbox as well on the onclick event but just appending the #[your params] to the URL.
Thanks,
Sayed.

Categories

Resources