I'd like to use https://github.com/lonekorean/mini-preview to create mouseover previews for parts of a website only.
I have no problems using anchors from the target website to have the script render a full website preview, scrolled to where an individual anchor is. That's not what I'm after however.
I'd like the script to show only the content of the anchors' parent <p> or <div>.
On the site, the link target anchors are coded like this:
<div class="paragraph"> <p> <a id="anchor_1"></a> Foo bar baz. </p> </div>
So, I'd like the little preview box to show Foo bar baz.
only.
I suspect the answer lies in this part of the script:
loadPreview: function() { this.$el.find('.' + PREFIX + '-frame') .attr('src', this.$el.attr('href')) .on('load', function() { // some sites don't set their background color $(this).css('background-color', '#fff'); });
specifically, the .attr('src', this.$el.attr('href'))
part. I'm not sure though.
Does anyone know how I can do this?
Or can you recommend some other script that I can use to do this and looks as nice as this one?
I'm not web dev, so please go easy on me.
Thanks
没有评论:
发表评论