I have the following code:
<a href="http://twitter.com/share" class="twitter-share-button" data-text="Text text text" data-count="none">
Tweet
</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
It adds to the text shortened url to the page on which the button was clicked. How can I disable auto adding url? Thanks.
The point of the twitter share button is to share the site you are on.
You can override it with the data-url attribute.
Tweet<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
You can at a custom url with the data-url attribute, than it ignores the url on the page he currently is:
Tweet<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
Related
How to get a img of uppper leve a tag href?
I need to change my content img src.
So, I want to get the uppper leve a tag href first.
In my limited experience with that
Now Code
<img src="test.png">
I want change to
<img src="data/abc.png">
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
any suggest? should me neef to use preg_replace?
Using jQuery you can do like below:
$(document).ready(function() {
$('img').attr('src', $('img').parent('a').attr('href'));
});
Working snippet:-
$(document).ready(function() {
$('img').attr('src', $('img').parent('a').attr('href'));
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a href="data/abc.png">
<img src="test.png">
</a>
Note:- if your document have multiple <a> with <img> in it, above code will change src of all.So be careful.
In PHP (update your code like below):
<a href="<?php php code to get href value ?>">
<img src="<? write the same php code to get href value ?>">
</a>
Here is my problem, I had describe in code project. When I am clicking in an icon it try to open in new page for showing image or pdf or video. But, I don't like this. I like to show that files in my iframe in same page. How can I do this ?
My code project link is:
Please don't open in new page. Just stay in same page.
I could suggest using a plugin as it makes things easier.
http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/
Alternatively what you want is to change the iframe src.
Using jQuery, you could for example, do something like this
<iframe id="myframe" style="display:none" width="630" height="420"></iframe>
<div class="fileIcon">
<a class="click" onClick="" rel="gallery" href="#">
<img src="src" title="" width='100' height='100' alt="" />
</a>
</div>
And JS
$('a').click(function(e){
e.preventDefault()
var s = $(this).find('img').attr('src');
$('#myframe').attr('src', s).show();
});
FIDDLE
This will get the image src and more it to the iframe
Give your iframe a name="myframe" then in your target you would use target="myframe"
I am using ShareThis to integrate social websites with my site. I want to be able to set the title of the share to whatever I like. Right now I am using:
<span class='st_facebook_vcount' displayText='Facebook'></span>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js">
</script> <script type="text/javascript">
stLight.options({
publisher:'12345',
});
</script>
<span class='st_twitter_vcount' displayText='Tweet'></span>
I want part of the title to be set dynamically via php variable (name of profile owner).How can this be ddone?
Thanks,
See http://support.sharethis.com/customer/portal/articles/475079-share-properties-and-sharing-custom-information add st_title="Your title" to the span:
<span class='st_facebook_vcount' displayText='Facebook' st_title="Your title></span>
i would like to know how to use a custom URL with ShareThis social share plugin. for a example i have a post summery on my index.php page taht is linking to my-post.php so what i want to do is to make users share my-post.php from my index page.
here is the code from sharethis.com
Buttons:
<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_googleplus_hcount' displayText='Google +'></span>
<span class='st_pinterest_hcount' displayText='Pinterest'></span>
JS:
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-448a73fe-e6c1-f7a5-f0a5-3912c860fc9e"});</script>
You can append a st_url property to each of your span tags which will control the URL that is shared.
<span class='st_facebook_hcount' st_url='http://my.custom.com/url' displayText='Facebook'></span>
Source: https://support.sharethis.com/hc/en-us/articles/218441477-How-to-Customize-which-URL-Text-and-IMG-to-Share
Just use st_url attribute like this:
<span class="st_sharethis" st_url="http://www.yoursite.com/innerpage.php" st_title="inner page title" displayText="ShareThis"></span>
You can just add an extra atrribute like
<div class="sharethis-inline-share-buttons" data-url="<!--YOUR_URL_GOES_HERE-->"></div>
I'm attempting to use embedded code from a page within my server, the problem is that when I also try to add URL links to my Facebook below it they're not working?
I'm using this code which was successfully implemented. I'm not sure if the links I'm adding is hidden behind the image, but if it is I'm not sure how to get the link to show on top of the background image.
<body>
<img src="images/background.jpg" alt="" id="background" />
Facebook Link
<div rel="00000000" class="lrdiscoverwidget" data-logo="on" data-background="off" data-share-url="www.domain.com" data-css="">
<script type="text/javascript" src="http://launchrock-ignition.s3.amazonaws.com/ignition.1.1.js"></script>
</div>
<script type="text/javascript">
$(window).load(function() {
$("#background").fullBg();
});
</script>
</body>
Thank you!